|
|
@@ -69,6 +69,17 @@ GetLastBitSet(DWORD *Index, UnitWord64 Mask)
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
+namespace {
|
|
|
+
|
|
|
+//ShiftValue is essentially log(sizeof(T))
|
|
|
+template <typename T> constexpr LONG BVUnitT_GetShiftValue();
|
|
|
+
|
|
|
+template<> constexpr LONG BVUnitT_GetShiftValue<UnitWord32>() { return 5; }
|
|
|
+
|
|
|
+template<> constexpr LONG BVUnitT_GetShiftValue<UnitWord64>() { return 6; }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
template <typename T>
|
|
|
class BVUnitT
|
|
|
{
|
|
|
@@ -222,9 +233,9 @@ public:
|
|
|
AllOnesMask = -1
|
|
|
};
|
|
|
|
|
|
- //ShiftValue is essentially log(sizeof(T))
|
|
|
- //Initialization is through template specialization
|
|
|
- static const LONG ShiftValue;
|
|
|
+ enum : LONG {
|
|
|
+ ShiftValue = BVUnitT_GetShiftValue<T>()
|
|
|
+ };
|
|
|
|
|
|
static BVIndex Position(BVIndex index)
|
|
|
{
|
|
|
@@ -488,9 +499,6 @@ public:
|
|
|
typedef BVUnitT<UnitWord32> BVUnit32;
|
|
|
typedef BVUnitT<UnitWord64> BVUnit64;
|
|
|
|
|
|
-template<> const __declspec(selectany) LONG BVUnitT<UnitWord32>::ShiftValue = 5;
|
|
|
-template<> const __declspec(selectany) LONG BVUnitT<UnitWord64>::ShiftValue = 6;
|
|
|
-
|
|
|
#if defined(_M_X64_OR_ARM64)
|
|
|
typedef BVUnit64 BVUnit;
|
|
|
#else
|