about summary refs log tree commit diff
path: root/src/libstd/num
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstd/num')
-rw-r--r--src/libstd/num/i16.rs6
-rw-r--r--src/libstd/num/i32.rs6
-rw-r--r--src/libstd/num/i64.rs6
-rw-r--r--src/libstd/num/i8.rs6
4 files changed, 12 insertions, 12 deletions
diff --git a/src/libstd/num/i16.rs b/src/libstd/num/i16.rs
index 42710a8b459..79827421f92 100644
--- a/src/libstd/num/i16.rs
+++ b/src/libstd/num/i16.rs
@@ -28,17 +28,17 @@ int_module!(i16, 16)
 impl Bitwise for i16 {
     /// Returns the number of ones in the binary representation of the number.
     #[inline]
-    fn count_ones(&self) -> i16 { unsafe { intrinsics::ctpop16(*self) } }
+    fn count_ones(&self) -> i16 { unsafe { intrinsics::ctpop16(*self as u16) as i16 } }
 
     /// Returns the number of leading zeros in the in the binary representation
     /// of the number.
     #[inline]
-    fn leading_zeros(&self) -> i16 { unsafe { intrinsics::ctlz16(*self) } }
+    fn leading_zeros(&self) -> i16 { unsafe { intrinsics::ctlz16(*self as u16) as i16 } }
 
     /// Returns the number of trailing zeros in the in the binary representation
     /// of the number.
     #[inline]
-    fn trailing_zeros(&self) -> i16 { unsafe { intrinsics::cttz16(*self) } }
+    fn trailing_zeros(&self) -> i16 { unsafe { intrinsics::cttz16(*self as u16) as i16 } }
 }
 
 impl CheckedAdd for i16 {
diff --git a/src/libstd/num/i32.rs b/src/libstd/num/i32.rs
index 69d4b0639f7..97f03299b87 100644
--- a/src/libstd/num/i32.rs
+++ b/src/libstd/num/i32.rs
@@ -28,17 +28,17 @@ int_module!(i32, 32)
 impl Bitwise for i32 {
     /// Returns the number of ones in the binary representation of the number.
     #[inline]
-    fn count_ones(&self) -> i32 { unsafe { intrinsics::ctpop32(*self) } }
+    fn count_ones(&self) -> i32 { unsafe { intrinsics::ctpop32(*self as u32) as i32 } }
 
     /// Returns the number of leading zeros in the in the binary representation
     /// of the number.
     #[inline]
-    fn leading_zeros(&self) -> i32 { unsafe { intrinsics::ctlz32(*self) } }
+    fn leading_zeros(&self) -> i32 { unsafe { intrinsics::ctlz32(*self as u32) as i32 } }
 
     /// Returns the number of trailing zeros in the in the binary representation
     /// of the number.
     #[inline]
-    fn trailing_zeros(&self) -> i32 { unsafe { intrinsics::cttz32(*self) } }
+    fn trailing_zeros(&self) -> i32 { unsafe { intrinsics::cttz32(*self as u32) as i32 } }
 }
 
 impl CheckedAdd for i32 {
diff --git a/src/libstd/num/i64.rs b/src/libstd/num/i64.rs
index 1f7066c25db..00823aa22c2 100644
--- a/src/libstd/num/i64.rs
+++ b/src/libstd/num/i64.rs
@@ -30,16 +30,16 @@ int_module!(i64, 64)
 impl Bitwise for i64 {
     /// Returns the number of ones in the binary representation of the number.
     #[inline]
-    fn count_ones(&self) -> i64 { unsafe { intrinsics::ctpop64(*self) } }
+    fn count_ones(&self) -> i64 { unsafe { intrinsics::ctpop64(*self as u64) as i64 } }
 
     /// Returns the number of leading zeros in the in the binary representation
     /// of the number.
     #[inline]
-    fn leading_zeros(&self) -> i64 { unsafe { intrinsics::ctlz64(*self) } }
+    fn leading_zeros(&self) -> i64 { unsafe { intrinsics::ctlz64(*self as u64) as i64 } }
 
     /// Counts the number of trailing zeros.
     #[inline]
-    fn trailing_zeros(&self) -> i64 { unsafe { intrinsics::cttz64(*self) } }
+    fn trailing_zeros(&self) -> i64 { unsafe { intrinsics::cttz64(*self as u64) as i64 } }
 }
 
 impl CheckedAdd for i64 {
diff --git a/src/libstd/num/i8.rs b/src/libstd/num/i8.rs
index 061ffddf231..2d349fa7f4f 100644
--- a/src/libstd/num/i8.rs
+++ b/src/libstd/num/i8.rs
@@ -28,17 +28,17 @@ int_module!(i8, 8)
 impl Bitwise for i8 {
     /// Returns the number of ones in the binary representation of the number.
     #[inline]
-    fn count_ones(&self) -> i8 { unsafe { intrinsics::ctpop8(*self) } }
+    fn count_ones(&self) -> i8 { unsafe { intrinsics::ctpop8(*self as u8) as i8 } }
 
     /// Returns the number of leading zeros in the in the binary representation
     /// of the number.
     #[inline]
-    fn leading_zeros(&self) -> i8 { unsafe { intrinsics::ctlz8(*self) } }
+    fn leading_zeros(&self) -> i8 { unsafe { intrinsics::ctlz8(*self as u8) as i8 } }
 
     /// Returns the number of trailing zeros in the in the binary representation
     /// of the number.
     #[inline]
-    fn trailing_zeros(&self) -> i8 { unsafe { intrinsics::cttz8(*self) } }
+    fn trailing_zeros(&self) -> i8 { unsafe { intrinsics::cttz8(*self as u8) as i8 } }
 }
 
 impl CheckedAdd for i8 {