File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -2603,13 +2603,16 @@ macro_rules! int_impl {
2603
2603
#[ must_use = "this returns the result of the operation, \
2604
2604
without modifying the original"]
2605
2605
#[ inline( always) ]
2606
- #[ rustc_allow_const_fn_unstable( const_cmp) ]
2607
2606
pub const fn signum( self ) -> Self {
2608
2607
// Picking the right way to phrase this is complicated
2609
2608
// (<https://graphics.stanford.edu/~seander/bithacks.html#CopyIntegerSign>)
2610
2609
// so delegate it to `Ord` which is already producing -1/0/+1
2611
2610
// exactly like we need and can be the place to deal with the complexity.
2612
- self . cmp( & 0 ) as _
2611
+
2612
+ // FIXME(const-hack): replace with cmp
2613
+ if self < 0 { -1 }
2614
+ else if self == 0 { 0 }
2615
+ else { 1 }
2613
2616
}
2614
2617
2615
2618
/// Returns `true` if `self` is positive and `false` if the number is zero or
You can’t perform that action at this time.
0 commit comments