Allow building with -Wshift-sign-overflow
[folly.git] / folly / test / SmallLocksTest.cpp
index 5bb9ddb59a06bb54c7d9b5f5a8c655da582b5c01..0c24664b905af2e273b123b7e009751c0329b6f6 100644 (file)
@@ -91,7 +91,8 @@ template<class T> struct PslTest {
   PslTest() { lock.init(); }
 
   void doTest() {
-    T ourVal = rand() % (T(1) << (sizeof(T) * 8 - 1));
+    using UT = typename std::make_unsigned<T>::type;
+    T ourVal = rand() % T(UT(1) << (sizeof(UT) * 8 - 1));
     for (int i = 0; i < 10000; ++i) {
       std::lock_guard<PicoSpinLock<T>> guard(lock);
       lock.setData(ourVal);