bit_util: Implement MostSignificantBit

This commit is contained in:
MerryMage 2018-06-28 21:44:35 +01:00
parent 95ad0d0a66
commit b00fe23b91

View file

@ -151,6 +151,11 @@ inline size_t LowestSetBit(T value) {
return result;
}
template <typename T>
inline bool MostSignificantBit(T value) {
return Bit<BitSize<T>() - 1, T>(value);
}
template <typename T>
inline T Replicate(T value, size_t element_size) {
ASSERT_MSG(BitSize<T>() % element_size == 0, "bitsize of T not divisible by element_size");