Changes imported from Abseil "staging" branch:
- f679f7de2957ac4dca0a862d04f1165d2f503525 Merge GitHub PR #78: Fix typo in thread_identity.h by Derek Mauro <dmauro@google.com> - 369cbefc9ebb8503e3c25b1516c856dab3bed7ac Minor refactor of operator-(uint128). by Alex Strelnikov <strel@google.com> - fba0f8c33b051d90936ad0fcaa4bea83f554bf8d Merge GitHub PR #75: Fix typo in per_thread_tls.h by Derek Mauro <dmauro@google.com> - 76d5d25a54ab93c1ea3bc74b5a28ba335b0f2bab Implement InlinedVector::shrink_to_fit() method. by Abseil Team <absl-team@google.com> GitOrigin-RevId: f679f7de2957ac4dca0a862d04f1165d2f503525 Change-Id: I03b39fdbd70c00a455d98d949d413dd7c8019578
This commit is contained in:
parent
98bff8b2bc
commit
c742b72354
3 changed files with 117 additions and 7 deletions
|
@ -460,13 +460,10 @@ inline bool operator>=(uint128 lhs, uint128 rhs) {
|
|||
// Unary operators.
|
||||
|
||||
inline uint128 operator-(uint128 val) {
|
||||
const uint64_t hi_flip = ~Uint128High64(val);
|
||||
const uint64_t lo_flip = ~Uint128Low64(val);
|
||||
const uint64_t lo_add = lo_flip + 1;
|
||||
if (lo_add < lo_flip) {
|
||||
return MakeUint128(hi_flip + 1, lo_add);
|
||||
}
|
||||
return MakeUint128(hi_flip, lo_add);
|
||||
uint64_t hi = ~Uint128High64(val);
|
||||
uint64_t lo = ~Uint128Low64(val) + 1;
|
||||
if (lo == 0) ++hi; // carry
|
||||
return MakeUint128(hi, lo);
|
||||
}
|
||||
|
||||
inline bool operator!(uint128 val) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue