Skip to content

Commit

Permalink
Parenthesize shift expressions (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
vbkaisetsu authored Dec 29, 2024
1 parent 811fd70 commit e78733a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/charwise/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,18 @@ where
let (i, rest) = unsafe { self.inner.next().unwrap_unchecked() };
let c = u32::from(rest & 0x3f);
if first < 0xe0 {
(i + 1, u32::from(first & 0x1f) << 6 | c)
(i + 1, (u32::from(first & 0x1f) << 6) | c)
} else {
// 3 bytes ~
let (i, rest) = unsafe { self.inner.next().unwrap_unchecked() };
let c = c << 6 | u32::from(rest & 0x3f);
let c = (c << 6) | u32::from(rest & 0x3f);
if first < 0xf0 {
(i + 1, u32::from(first & 0x0f) << 12 | c)
(i + 1, (u32::from(first & 0x0f) << 12) | c)
} else {
// 4 bytes
let (i, rest) = unsafe { self.inner.next().unwrap_unchecked() };
let c = c << 6 | u32::from(rest & 0x3f);
(i + 1, u32::from(first & 0x07) << 18 | c)
let c = (c << 6) | u32::from(rest & 0x3f);
(i + 1, (u32::from(first & 0x07) << 18) | c)
}
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/intpack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ impl U24nU8 {

#[inline(always)]
pub fn set_a(&mut self, a: U24) {
self.0 = a.get() << 8 | u32::from(self.b());
self.0 = (a.get() << 8) | u32::from(self.b());
}

#[inline(always)]
pub fn set_b(&mut self, b: u8) {
self.0 = self.a().get() << 8 | u32::from(b);
self.0 = (self.a().get() << 8) | u32::from(b);
}
}

Expand Down

0 comments on commit e78733a

Please sign in to comment.