]> git.lizzy.rs Git - rust.git/commit
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)
commit782da867c801441212a00f20bf75bc312c815460
treeb5a28120b12e5a4e65361c2163a10cec4aa7a115
parent192eecd53a41bb32f2a44a854697835ff67ee890
parentfcbc12eae35296841b0ddd3bacbb43e1d0ae654e
Rollup merge of #106798 - scottmcm:signum-via-cmp, r=Mark-Simulacrum

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>
library/core/src/num/int_macros.rs