Use the least significant beat to determine if int/uint is even

This commit is contained in:
Flavio Percoco 2014-01-15 17:42:23 +01:00
parent 7bebdbd968
commit 515978d1bd
2 changed files with 2 additions and 2 deletions

View file

@ -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]

View file

@ -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]