auto merge of #11568 : FlaPer87/rust/even, r=alexcrichton

This implementation should be a bit more optimal than calling `self.is_multiple_of(&2)`
This commit is contained in:
bors 2014-01-15 16:02:01 -08:00
commit 36971217aa
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]