Пример #1
0
        public void InterlockedAnd_Int32()
        {
            int value = 0x12345670;

            Assert.Equal(0x12345670, Interlocked.And(ref value, 0x7654321));
            Assert.Equal(0x02244220, value);
        }
Пример #2
0
        public void InterlockedAnd_UInt64()
        {
            ulong value = 0x12345670u;

            Assert.Equal(0x12345670u, Interlocked.And(ref value, 0x7654321));
            Assert.Equal(0x02244220u, value);
        }
Пример #3
0
 private static nuint mi_atomic_fetch_and_explicit([NativeTypeName("std::atomic<uintptr_t>*")] ref nuint p, [NativeTypeName("uintptr_t")] nuint x, mi_memory_order_t mo)
 {
     if (Environment.Is64BitProcess)
     {
         return((nuint)Interlocked.And(ref Unsafe.As <nuint, ulong>(ref p), x));
     }
     else
     {
         return(Interlocked.And(ref Unsafe.As <nuint, uint>(ref p), (uint)x));
     }
 }