Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For full feature parity with
subtle, this adds a conditional negation trait calledCtNeg.It uses a slightly different design from
subtle, supporting both in-place operation alasubtlewithct_neg_assign, while also supportingcore::ops::Neg-like usage withct_neg.Using one trait with two methods permits a default implementation of
ct_neg_assignwhile still letting it be overridden, which is useful for e.g. heap-allocated types. It could arguably be split intoCtNegandCtNegAssignbut we would lose that default impl (and the same argument could be made for splitting up e.g.CtSelect, with the same drawbacks)By default impls are written for the signed integer (
i*) types:i8,i16,i32,i64,i128.