static inline u32 u32_bit_reverse(u32 v)
{
u32 r = v;
int s = 31;
for (v >>= 1; v; v >>= 1)
{
r <<= 1;
r |= v & 1;
s--;
}
r <<= s;
return r;
}
static inline u8 u8_bit_reverse(u8 v)
{
u8 r = v;
int s = 7;
for (v >>= 1; v; v >>= 1)
{
r <<= 1;
r |= v & 1;
s--;
}
r <<= s;
return r;
}
static inline u16 u16_bit_reverse(u16 v)
{
u16 r = v;
int s = 15;
for (v >>= 1; v; v >>= 1)
{
r <<= 1;
r |= v & 1;
s--;
}
r <<= s;
return r;
}
static inline u64 u64_bit_reverse(u64 v)
{
u64 r = v;
int s = 63;
for (v >>= 1; v; v >>= 1)
{
r <<= 1;
r |= v & 1;
s--;
}
r <<= s;
return r;
}