Use the least significant beat to determine if int/uint is even
This commit is contained in:
parent
7bebdbd968
commit
515978d1bd
2 changed files with 2 additions and 2 deletions
|
@ -308,7 +308,7 @@ impl Integer for $T {
|
|||
|
||||
/// Returns `true` if the number is divisible by `2`
|
||||
#[inline]
|
||||
fn is_even(&self) -> bool { self.is_multiple_of(&2) }
|
||||
fn is_even(&self) -> bool { self & 1 == 0 }
|
||||
|
||||
/// Returns `true` if the number is not divisible by `2`
|
||||
#[inline]
|
||||
|
|
|
@ -169,7 +169,7 @@ impl Integer for $T {
|
|||
|
||||
/// Returns `true` if the number is divisible by `2`
|
||||
#[inline]
|
||||
fn is_even(&self) -> bool { self.is_multiple_of(&2) }
|
||||
fn is_even(&self) -> bool { self & 1 == 0 }
|
||||
|
||||
/// Returns `true` if the number is not divisible by `2`
|
||||
#[inline]
|
||||
|
|
Loading…
Reference in a new issue