mirror of
https://github.com/anrieff/libcpuid
synced 2024-12-16 16:35:45 +00:00
Make get_bits_value() more robust
This commit is contained in:
parent
1d5ac6f23f
commit
841c975e95
1 changed files with 1 additions and 1 deletions
|
@ -438,7 +438,7 @@ uint64_t get_bits_value(uint64_t val, int highbit, int lowbit)
|
|||
uint64_t data = val;
|
||||
const uint8_t bits = highbit - lowbit + 1;
|
||||
|
||||
if(bits < 64) {
|
||||
if(bits < 64 && highbit < 64 && lowbit < highbit) {
|
||||
/* Show only part of register */
|
||||
data >>= lowbit;
|
||||
data &= (1ULL << bits) - 1;
|
||||
|
|
Loading…
Reference in a new issue