Skip to content

Commit

Permalink
Rollup merge of rust-lang#64941 - lzutao:inline-max_min_value, r=nnet…
Browse files Browse the repository at this point in the history
…hercote

Inline `{min,max}_value` even in debug builds

I think it is worth to inline `{min,max}_value` even in debug builds.
See this godbolt link: https://godbolt.org/z/-COkVS
  • Loading branch information
Centril committed Oct 3, 2019
2 parents c6293e3 + 3b49ab6 commit b131230
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/libcore/num/mod.rs
Expand Up @@ -252,7 +252,7 @@ Basic usage:
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
#[inline(always)]
#[rustc_promotable]
pub const fn min_value() -> Self {
!0 ^ ((!0 as $UnsignedT) >> 1) as Self
Expand All @@ -271,7 +271,7 @@ Basic usage:
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
#[inline(always)]
#[rustc_promotable]
pub const fn max_value() -> Self {
!Self::min_value()
Expand Down Expand Up @@ -2311,7 +2311,7 @@ Basic usage:
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_promotable]
#[inline]
#[inline(always)]
pub const fn min_value() -> Self { 0 }
}

Expand All @@ -2328,7 +2328,7 @@ stringify!($MaxV), ");", $EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_promotable]
#[inline]
#[inline(always)]
pub const fn max_value() -> Self { !0 }
}

Expand Down

0 comments on commit b131230

Please sign in to comment.