mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-04 02:54:00 +00:00
Use the least significant beat to determine if int/uint is even
This commit is contained in:
parent
7bebdbd968
commit
515978d1bd
@ -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 New Issue
Block a user