blob: 2c891b5e635d1527958f448d1bb481a7eec4ee20 (
plain)
1
2
3
4
5
6
7
8
|
// Fills the bits from begin to end with 1s and leaves the rest as 0.
template<typename IntegralT>
inline IntegralT bitmask(IntegralT begin, IntegralT end)
{
IntegralT filled_bits = (1 << (end - begin + 1)) - 1;
return filled_bits << begin;
}
|