diff options
| author | Palmer Cox <p@lmercox.com> | 2013-08-11 23:14:27 -0400 |
|---|---|---|
| committer | Palmer Cox <p@lmercox.com> | 2013-08-17 00:22:27 -0400 |
| commit | 6386f887a7e7ac1581075ba296edf1a66f375f08 (patch) | |
| tree | 9d0b7d7b5b09d5b570cee7eb151b0aae81f1f6ea /src/rt/rust_exchange_alloc.cpp | |
| parent | c7070653252be9a103f7068ae6a38619de76d913 (diff) | |
| download | rust-6386f887a7e7ac1581075ba296edf1a66f375f08.tar.gz rust-6386f887a7e7ac1581075ba296edf1a66f375f08.zip | |
Crypto: update checked addition functions to use CheckedAdd intrinsic.
The shift_add_check_overflow and shift_add_check_overflow_tuple functions are re-written to be more efficient and to make use of the CheckedAdd instrinsic instead of manually checking for integer overflow. * The invokation leading_zeros() is removed and replaced with simple integer comparison. The leading_zeros() method results in a ctpop LLVM instruction and it may not be efficient on all architectures; integer comparisons, however, are efficient on just about any architecture. * The methods lose the ability for the caller to specify a particular shift value - that functionality wasn't being used and removing it allows for the code to be simplified. * Finally, the methods are renamed to add_bytes_to_bits and add_bytes_to_bits_tuple to reflect their very specific purposes.
Diffstat (limited to 'src/rt/rust_exchange_alloc.cpp')
0 files changed, 0 insertions, 0 deletions
