]> git.lizzy.rs Git - rust.git/commit
Rollup merge of #64386 - tspiteri:const-abs2, r=oli-obk
authorMazdak Farrokhzad <twingoow@gmail.com>
Wed, 25 Sep 2019 14:26:16 +0000 (16:26 +0200)
committerGitHub <noreply@github.com>
Wed, 25 Sep 2019 14:26:16 +0000 (16:26 +0200)
commitb30238e3125a6c1ebf95cf47e58566efc75ad2f1
tree944f34fe94128685e9af27ebe5b2ed552208291a
parentc26f1296d2d7a5f0c6e0b4f5cc00d59b341bcf09
parent562903a0a684860c0e51971ea11f1ce97795d6a2
Rollup merge of #64386 - tspiteri:const-abs2, r=oli-obk

use `sign` variable in abs and wrapping_abs methods

This also makes the code easier to understand by hinting at the significance of `self >> ($BITS - 1)`.

Also, now `overflowing_abs` simply uses `wrapping_abs`, which is clearer and avoids a potential performance regression in the LLVM IR.

This PR follows from the discussion from #63786.

r? @eddyb
cc @nikic
src/libcore/num/mod.rs