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 930ea07 commit 963398aCopy full SHA for 963398a
blockalloc/src/lib.rs
@@ -47,8 +47,7 @@ impl Block {
47
/// Instantiate a new block of the given size. Size must be a power of two.
48
// ANCHOR: BlockNew
49
pub fn new(size: BlockSize) -> Result<Block, BlockError> {
50
- // validate that size is a power of two
51
- if !(size & (size - 1) == 0) {
+ if !size.is_power_of_two() {
52
return Err(BlockError::BadRequest);
53
}
54
0 commit comments