-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
With the merge of #57234, we can now make wrapping_neg
and overflowing_neg
into const
as well. They are currently branching, but with a small amount of bit math you can make it branchless instead.
Basic formulas given here, along with some tests: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=6a800d9c97885c1aba464ea3103c86e6
(Issue filed per the general request of @Centril to seek and const
all possible const
targets)
Metadata
Metadata
Assignees
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.