Fix a typo in PicoSpinLock
[folly.git] / folly / PicoSpinLock.h
index 9f52a7a9a86e5af27b9c94a7730a65f6afa8ed1c..218b30622cfb6dbd7eb885d32194c3cfd0c2cdea 100644 (file)
@@ -132,7 +132,8 @@ struct PicoSpinLock {
     switch (sizeof(IntType)) {
       case 2:
         // There is no _interlockedbittestandset16 for some reason :(
-        ret = _InterlockedOr16((volatile short*)&lock, 1 << Bit) & (1 << Bit);
+        ret = _InterlockedOr16(
+            (volatile short*)&lock_, (short)kLockBitMask_) & kLockBitMask_;
         break;
       case 4:
         ret = _interlockedbittestandset((volatile long*)&lock_, Bit);
@@ -210,7 +211,7 @@ struct PicoSpinLock {
     switch (sizeof(IntType)) {
       case 2:
         // There is no _interlockedbittestandreset16 for some reason :(
-        _InterlockedAnd16((volatile short*)&lock, ~(1 << Bit));
+        _InterlockedAnd16((volatile short*)&lock_, (short)~kLockBitMask_);
         break;
       case 4:
         _interlockedbittestandreset((volatile long*)&lock_, Bit);