static T load(const Unaligned<T>& x) { return x.value; }
static void store(Unaligned<T>& x, T v) { x.value = v; }
static T loadRMW(const Unaligned<T>& x) {
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wuninitialized"
+ FOLLY_PUSH_WARNING
+ FOLLY_GCC_DISABLE_WARNING("-Wuninitialized")
#if !__clang__ // for gcc version [4.8, ?)
-#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+ FOLLY_GCC_DISABLE_WARNING("-Wmaybe-uninitialized")
#endif
return x.value;
-#pragma GCC diagnostic pop
+ FOLLY_POP_WARNING
}
};
store(UnalignedNoASan<T>& x, T v) { x.value = v; }
static T FOLLY_DISABLE_ADDRESS_SANITIZER
loadRMW(const UnalignedNoASan<T>& x) {
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wuninitialized"
+ FOLLY_PUSH_WARNING
+ FOLLY_GCC_DISABLE_WARNING("-Wuninitialized")
#if !__clang__ // for gcc version [4.8, ?)
-#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+ FOLLY_GCC_DISABLE_WARNING("-Wmaybe-uninitialized")
#endif
return x.value;
-#pragma GCC diagnostic pop
+ FOLLY_POP_WARNING
}
};
static T load(const T& x) { return x; }
static void store(T& x, T v) { x = v; }
static T loadRMW(const T& x) {
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wuninitialized"
+ FOLLY_PUSH_WARNING
+ FOLLY_GCC_DISABLE_WARNING("-Wuninitialized")
#if !__clang__ // for gcc version [4.8, ?)
-#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+ FOLLY_GCC_DISABLE_WARNING("-Wmaybe-uninitialized")
#endif
return x;
-#pragma GCC diagnostic pop
+ FOLLY_POP_WARNING
}
};
// gcc 4.8 needs more -Wmaybe-uninitialized tickling, as it propagates the
// taint upstream from loadRMW
-
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wuninitialized"
+FOLLY_PUSH_WARNING
+FOLLY_GCC_DISABLE_WARNING("-Wuninitialized")
#if !__clang__ // for gcc version [4.8, ?)
-#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+FOLLY_GCC_DISABLE_WARNING("-Wmaybe-uninitialized")
#endif
template <class T, class Traits>
size_t countInThisBlock = bitsPerBlock - offset;
size_t countInNextBlock = count - countInThisBlock;
- UnderlyingType thisBlock = value & ((one << countInThisBlock) - 1);
- UnderlyingType nextBlock = value >> countInThisBlock;
+ UnderlyingType thisBlock = UnderlyingType(value & ones(countInThisBlock));
+ UnderlyingType nextBlock = UnderlyingType(value >> countInThisBlock);
if (std::is_signed<UnderlyingType>::value) {
nextBlock &= ones(countInNextBlock);
}
Traits::store(*p, v);
}
-#pragma GCC diagnostic pop
+FOLLY_POP_WARNING
template <class T, class Traits>
inline bool Bits<T, Traits>::test(const T* p, size_t bit) {