File tree Expand file tree Collapse file tree 1 file changed +9
-11
lines changed
src/aero_kernel/src/utils Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -100,20 +100,18 @@ impl<A: Allocator> Bitmap<A> {
100
100
for ( i, block) in self . bitmap . iter ( ) . enumerate ( ) {
101
101
let mut block_value = * block;
102
102
103
- if block_value == 0 {
104
- return Some ( i * BLOCK_BITS ) ;
105
- }
103
+ if block_value != usize:: MAX {
104
+ let mut bit = 0 ;
106
105
107
- let mut bit = 0 ;
106
+ // Loop through the bits in the block and find
107
+ // the first unset bit.
108
+ while block_value. get_bit ( 0 ) {
109
+ block_value >>= 1 ;
110
+ bit += 1 ;
111
+ }
108
112
109
- // Loop through the bits in the block and find
110
- // the first unset bit.
111
- while block_value. get_bit ( 0 ) {
112
- block_value >>= 1 ;
113
- bit += 1 ;
113
+ return Some ( ( i * BLOCK_BITS ) + bit) ;
114
114
}
115
-
116
- return Some ( ( i * BLOCK_BITS ) + bit) ;
117
115
}
118
116
119
117
None
You can’t perform that action at this time.
0 commit comments