summary refs log tree commit diff
path: root/src/libstd/num
diff options
context:
space:
mode:
authorFlavio Percoco <flaper87@gmail.com>2014-01-15 17:42:23 +0100
committerFlavio Percoco <flaper87@gmail.com>2014-01-15 19:11:00 +0100
commit515978d1bd3a4256903a48a47da7df19283c33e2 (patch)
tree134ef08cf0bcbaa6a1e4b63440cf030dfe1ec437 /src/libstd/num
parent7bebdbd96826cc70c8e39d025a64b76cd64a2ee7 (diff)
downloadrust-515978d1bd3a4256903a48a47da7df19283c33e2.tar.gz
rust-515978d1bd3a4256903a48a47da7df19283c33e2.zip
Use the least significant beat to determine if int/uint is even
Diffstat (limited to 'src/libstd/num')
-rw-r--r--src/libstd/num/int_macros.rs2
-rw-r--r--src/libstd/num/uint_macros.rs2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/libstd/num/int_macros.rs b/src/libstd/num/int_macros.rs
index 0e7e4277dd6..8e48fcf5872 100644
--- a/src/libstd/num/int_macros.rs
+++ b/src/libstd/num/int_macros.rs
@@ -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]
diff --git a/src/libstd/num/uint_macros.rs b/src/libstd/num/uint_macros.rs
index 1a256981d74..852fc5016b0 100644
--- a/src/libstd/num/uint_macros.rs
+++ b/src/libstd/num/uint_macros.rs
@@ -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]