|
|
@@ -738,6 +738,40 @@ GLM_FUNC_QUALIFIER detail::tvec4<valType> bitRotateLeft
|
|
|
bitRotateLeft(Value[3], Shift));
|
|
|
}
|
|
|
|
|
|
+template <typename genIUType>
|
|
|
+GLM_FUNC_QUALIFIER genIUType fillBitfieldWithOne
|
|
|
+(
|
|
|
+ genIUType const & Value,
|
|
|
+ int const & FromBit,
|
|
|
+ int const & ToBit
|
|
|
+)
|
|
|
+{
|
|
|
+ assert(FromBit <= ToBit);
|
|
|
+ assert(ToBit <= sizeof(genIUType) * std::size_t(8));
|
|
|
+
|
|
|
+ genIUType Result = Value;
|
|
|
+ for(std::size_t i = 0; i <= ToBit; ++i)
|
|
|
+ Result |= (1 << i);
|
|
|
+ return Result;
|
|
|
+}
|
|
|
+
|
|
|
+template <typename genIUType>
|
|
|
+GLM_FUNC_QUALIFIER genIUType fillBitfieldWithZero
|
|
|
+(
|
|
|
+ genIUType const & Value,
|
|
|
+ int const & FromBit,
|
|
|
+ int const & ToBit
|
|
|
+)
|
|
|
+{
|
|
|
+ assert(FromBit <= ToBit);
|
|
|
+ assert(ToBit <= sizeof(genIUType) * std::size_t(8));
|
|
|
+
|
|
|
+ genIUType Result = Value;
|
|
|
+ for(std::size_t i = 0; i <= ToBit; ++i)
|
|
|
+ Result &= ~(1 << i);
|
|
|
+ return Result;
|
|
|
+}
|
|
|
+
|
|
|
}//namespace bit
|
|
|
}//namespace gtx
|
|
|
}//namespace glm
|