]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #106798 - scottmcm:signum-via-cmp, r=Mark-Simulacrum
authorMatthias Krüger <matthias.krueger@famsik.de>
Sun, 29 Jan 2023 19:03:36 +0000 (20:03 +0100)
committerGitHub <noreply@github.com>
Sun, 29 Jan 2023 19:03:36 +0000 (20:03 +0100)
Implement `signum` with `Ord`

Rather than needing to do things like #105840 for `signum` too, might as well just implement that method using `Ord`, since it's doing the same "I need `-1`/`0`/`+1`" behaviour that `cmp` is already doing.

This also seems to slightly improve the assembly: <https://rust.godbolt.org/z/5oEEqbxK1>

1  2 
library/core/src/num/int_macros.rs

Simple merge