Skip to content

Commit 0e9eb60

Browse files
committed
Rollup merge of rust-lang#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.
2 parents 216fdaf + 7ba5f16 commit 0e9eb60

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/libcore/num/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,14 @@ macro_rules! int_impl {
113113
$mul_with_overflow:path) => {
114114
/// Returns the smallest value that can be represented by this integer type.
115115
#[stable(feature = "rust1", since = "1.0.0")]
116+
#[inline]
116117
pub fn min_value() -> $T {
117118
(-1 as $T) << ($BITS - 1)
118119
}
119120

120121
/// Returns the largest value that can be represented by this integer type.
121122
#[stable(feature = "rust1", since = "1.0.0")]
123+
#[inline]
122124
pub fn max_value() -> $T {
123125
let min = $T::min_value(); !min
124126
}

0 commit comments

Comments
 (0)