Simulate tearing a double in C#

后端 未结 4 1403
北恋
北恋 2020-12-15 06:02

I\'m running on a 32-bit machine and I\'m able to confirm that long values can tear using the following code snippet which hits very quickly.

        static          


        
4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-15 06:59

    As strange as it sounds, that depends on your CPU. While doubles are not guaranteed not to tear, they won't on many current processors. Try an AMD Sempron if you want tearing in this situation.

    EDIT: Learned that the hard way a few years ago.

提交回复
热议问题