Skip to content

Commit ff71fea

Browse files
xtqqczzejswrenn
authored andcommitted
Use _::BITS instead of 8 * std::mem::size_of::<_>()
1 parent 4e9b9a5 commit ff71fea

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

benches/tree_reduce.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ trait IterEx: Iterator {
1212
Self: Sized,
1313
{
1414
let hint = self.size_hint().0;
15-
let cap = std::mem::size_of::<usize>() * 8 - hint.leading_zeros() as usize;
16-
let mut stack = Vec::with_capacity(cap);
15+
let capacity = usize::BITS - hint.leading_zeros();
16+
let mut stack = Vec::with_capacity(capacity as usize);
1717
self.enumerate().for_each(|(mut i, mut x)| {
1818
while (i & 1) != 0 {
1919
x = f(stack.pop().unwrap(), x);

0 commit comments

Comments
 (0)