subtle
subtle copied to clipboard
add usize/isize to generated trait impls
It seems like usize
and isize
could reasonably be allowed to implement ConstantTime{Greater,Less}
via the macros that are already used for other integer types. I assumed it was an oversight that this wasn't already done.
See also previous rationale on #83
I've encountered a use case for this: when you are using usize
as an index, looping over every item of a n-length collection.
In my particular case, it involves computing a value on an entry at a given index, and then selecting whether to store or discard the result based on whether or not the index matches a specified value.
Here's a real-world example: https://github.com/RustCrypto/crypto-bigint/blob/4aee8ce1e185f9c1156a162ecce6164bf80ab915/src/uint/boxed/bits.rs#L40