bits: remove unnecessary xor
This commit is contained in:
parent
16a229c936
commit
e561adbb6f
1 changed files with 2 additions and 2 deletions
|
@ -14,7 +14,7 @@ void bit_set_range(unsigned long *bitfield, usize first, usize count)
|
|||
/* test if the entire bit range is contained within this longword */
|
||||
if (bit + count < LONG_BIT) {
|
||||
unsigned long low_mask = (1lu << bit) - 1; /* 0b000..011 */
|
||||
unsigned long high_mask = ~0lu ^ ((1lu << (bit + count)) - 1); /* 0b110..000 */
|
||||
unsigned long high_mask = ~( (1lu << (bit + count)) - 1 ); /* 0b110..000 */
|
||||
*bitfield |= ~(low_mask | high_mask);
|
||||
} else {
|
||||
/* if the first bit isn't longword aligned, manually set the upper
|
||||
|
@ -47,7 +47,7 @@ void bit_clr_range(unsigned long *bitfield, usize first, usize count)
|
|||
|
||||
if (bit + count < LONG_BIT) {
|
||||
unsigned long low_mask = (1lu << bit) - 1;
|
||||
unsigned long high_mask = ~0lu ^ ((1lu << (bit + count)) - 1);
|
||||
unsigned long high_mask = ~( (1lu << (bit + count)) - 1 );
|
||||
*bitfield &= low_mask | high_mask;
|
||||
} else {
|
||||
if (bit != 0) {
|
||||
|
|
Loading…
Reference in a new issue