From 7bc7ddfc87b88e928cc5bc5aa090ebe756fa52fb Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 10 Aug 2016 22:21:00 -0700 Subject: [PATCH] traits: inline PrimInt methods --- traits/src/int.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/traits/src/int.rs b/traits/src/int.rs index 6cc90ca..0cf9e13 100644 --- a/traits/src/int.rs +++ b/traits/src/int.rs @@ -280,66 +280,82 @@ pub trait PrimInt macro_rules! prim_int_impl { ($T:ty, $S:ty, $U:ty) => ( impl PrimInt for $T { + #[inline] fn count_ones(self) -> u32 { <$T>::count_ones(self) } + #[inline] fn count_zeros(self) -> u32 { <$T>::count_zeros(self) } + #[inline] fn leading_zeros(self) -> u32 { <$T>::leading_zeros(self) } + #[inline] fn trailing_zeros(self) -> u32 { <$T>::trailing_zeros(self) } + #[inline] fn rotate_left(self, n: u32) -> Self { <$T>::rotate_left(self, n) } + #[inline] fn rotate_right(self, n: u32) -> Self { <$T>::rotate_right(self, n) } + #[inline] fn signed_shl(self, n: u32) -> Self { ((self as $S) << n) as $T } + #[inline] fn signed_shr(self, n: u32) -> Self { ((self as $S) >> n) as $T } + #[inline] fn unsigned_shl(self, n: u32) -> Self { ((self as $U) << n) as $T } + #[inline] fn unsigned_shr(self, n: u32) -> Self { ((self as $U) >> n) as $T } + #[inline] fn swap_bytes(self) -> Self { <$T>::swap_bytes(self) } + #[inline] fn from_be(x: Self) -> Self { <$T>::from_be(x) } + #[inline] fn from_le(x: Self) -> Self { <$T>::from_le(x) } + #[inline] fn to_be(self) -> Self { <$T>::to_be(self) } + #[inline] fn to_le(self) -> Self { <$T>::to_le(self) } + #[inline] fn pow(self, exp: u32) -> Self { <$T>::pow(self, exp) }