diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2015-05-01 11:12:17 +0530 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2015-05-01 20:20:20 +0530 |
| commit | 0e9eb6022ebff46cda9fcdca50d76ae971eab61e (patch) | |
| tree | 5be338d07ad583dbbb85ae7449ed3ec50a675096 /src/libcore | |
| parent | 216fdafd71f8f5dfe1a314792b676365e4ccfbd1 (diff) | |
| parent | 7ba5f166b4643e7d64effda522a63d6710b5ccb3 (diff) | |
| download | rust-0e9eb6022ebff46cda9fcdca50d76ae971eab61e.tar.gz rust-0e9eb6022ebff46cda9fcdca50d76ae971eab61e.zip | |
Rollup merge of #25010 - huonw:inline-int-extremes, r=alexcrichton
These compile down to `mov $CONSTANT, register; ret`, but the lack of `#[inline]` meant they have a full `call ...` when used from external crates.
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/num/mod.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index b8638c5b09b..22f4e854655 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -113,12 +113,14 @@ macro_rules! int_impl { $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 } |
