We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bfb5219 commit 6ece05dCopy full SHA for 6ece05d
reverse-bits/yhkee0404.rs
@@ -5,10 +5,10 @@ static _TABLE: OnceLock<Vec<i32>> = OnceLock::new();
5
impl Solution {
6
7
pub fn reverse_bits(mut n: i32) -> i32 {
8
- let mut x: u32 = 0;
+ let mut x = 0;
9
for i in 0..6 {
10
- let shift = if i == 5 {2} else {6} as u32;
11
- x = x << shift | Self::init_table()[(n & (1 << shift) - 1) as usize] as u32 >> 6 - shift;
+ let shift = if i == 5 {2} else {6};
+ x = x << shift | Self::init_table()[(n & (1 << shift) - 1) as usize] >> 6 - shift;
12
n >>= 6;
13
}
14
x as i32
0 commit comments