2023-12-06 17:15:32 +00:00
|
|
|
#include <librr/bitfield.h>
|
|
|
|
|
|
|
|
inline bool_t rr_is_bit_set(u64_t buffer, usz_t index)
|
|
|
|
{
|
|
|
|
return !!(buffer & (1 << index));
|
|
|
|
}
|
|
|
|
|
|
|
|
inline u64_t rr_set_bit(u64_t buffer, usz_t index)
|
|
|
|
{
|
|
|
|
return buffer | (1 << index);
|
|
|
|
}
|
|
|
|
|
|
|
|
u64_t rr_bitpad_lsb(usz_t count)
|
|
|
|
{
|
|
|
|
u64_t result = 0;
|
|
|
|
for(usz_t index = 0; index < count; ++index)
|
|
|
|
{
|
|
|
|
result |= 1 << index;
|
|
|
|
}
|
2023-12-09 20:24:05 +00:00
|
|
|
return result;
|
2023-12-06 17:15:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
u64_t rr_bitpad_msb(usz_t count)
|
|
|
|
{
|
|
|
|
u64_t result = 0;
|
|
|
|
for(usz_t index = 0; index < count; ++index)
|
|
|
|
{
|
|
|
|
result |= (1 << 63) >> index;
|
|
|
|
}
|
2023-12-09 20:24:05 +00:00
|
|
|
return result;
|
2023-12-06 17:15:32 +00:00
|
|
|
}
|