fix get bits
This commit is contained in:
parent
9cdf9f0ff5
commit
88b79bccb9
@ -31,8 +31,7 @@ uint32_t get_bits(uint32_t value, uint32_t from, uint32_t to) {
|
|||||||
return (value & (1 << from)) != 0;
|
return (value & (1 << from)) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t mask = ~(1U << (to - from + 1));
|
return (value << (31 - to)) >> (from + (31 - to));
|
||||||
return (value & mask) >> from;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int is_bit_set(uint32_t value, uint32_t at) {
|
int is_bit_set(uint32_t value, uint32_t at) {
|
||||||
|
Loading…
Reference in New Issue
Block a user