Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/libstd/num/int_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,10 @@ impl Integer for $T {
fn is_odd(&self) -> bool { !self.is_even() }
}

impl Bitwise for $T {}
impl Bitwise for $T {
#[inline]
fn compl(&self) -> $T { -1 as $T ^ *self }
}

#[cfg(not(test))]
impl BitOr<$T,$T> for $T {
Expand Down
5 changes: 4 additions & 1 deletion src/libstd/num/num.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,10 @@ pub trait Bitwise: Not<Self>
+ BitOr<Self,Self>
+ BitXor<Self,Self>
+ Shl<Self,Self>
+ Shr<Self,Self> {}
+ Shr<Self,Self> {
// Computes the bitwise complement
fn compl(&self) -> Self;
}

pub trait BitCount {
fn population_count(&self) -> Self;
Expand Down
5 changes: 4 additions & 1 deletion src/libstd/num/uint_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,10 @@ impl Integer for $T {
fn is_odd(&self) -> bool { !self.is_even() }
}

impl Bitwise for $T {}
impl Bitwise for $T {
#[inline]
fn compl(&self) -> $T { -1 as $T ^ *self }
}

#[cfg(not(test))]
impl BitOr<$T,$T> for $T {
Expand Down