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 {
26032603 #[ must_use = "this returns the result of the operation, \
26042604 without modifying the original"]
26052605 #[ inline( always) ]
2606- #[ rustc_allow_const_fn_unstable( const_cmp) ]
26072606 pub const fn signum( self ) -> Self {
26082607 // Picking the right way to phrase this is complicated
26092608 // (<https://graphics.stanford.edu/~seander/bithacks.html#CopyIntegerSign>)
26102609 // so delegate it to `Ord` which is already producing -1/0/+1
26112610 // 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 }
26132616 }
26142617
26152618 /// 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