From 7ba5f166b4643e7d64effda522a63d6710b5ccb3 Mon Sep 17 00:00:00 2001 From: Huon Wilson Date: Fri, 1 May 2015 08:56:13 +1000 Subject: [PATCH] Mark the {min,max}_value functions on integers #[inline]. These compile down to `mov $CONSTANT, register; ret`, but the lack of `#[inline]` meant they have a full `call ...` when used from external crates. --- src/libcore/num/mod.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 44d5333ce1f..f6c1960c30e 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -113,12 +113,14 @@ unsafe fn bswap8(x: u8) -> u8 { x } $mul_with_overflow:path) => { /// Returns the smallest value that can be represented by this integer type. #[stable(feature = "rust1", since = "1.0.0")] + #[inline] pub fn min_value() -> $T { (-1 as $T) << ($BITS - 1) } /// Returns the largest value that can be represented by this integer type. #[stable(feature = "rust1", since = "1.0.0")] + #[inline] pub fn max_value() -> $T { let min = $T::min_value(); !min } -- GitLab