Simplify lines with __builtin_addcll and friends

This commit is contained in:
Junekey Jeon 2022-01-13 15:45:33 -08:00 committed by Victor Zverovich
parent 76336b4f63
commit 2e4038bf51

View File

@ -802,13 +802,12 @@ struct uint128_wrapper {
#if FMT_HAS_BUILTIN(__builtin_addcll) #if FMT_HAS_BUILTIN(__builtin_addcll)
unsigned long long carry; unsigned long long carry;
low_ = __builtin_addcll(low_, n, 0, &carry); low_ = __builtin_addcll(low_, n, 0, &carry);
high_ = __builtin_addcll(high_, 0, carry, &carry); high_ += carry;
#elif FMT_HAS_BUILTIN(__builtin_ia32_addcarryx_u64) #elif FMT_HAS_BUILTIN(__builtin_ia32_addcarryx_u64)
unsigned long long result; unsigned long long result;
auto carry = __builtin_ia32_addcarryx_u64(0, low_, n, &result); auto carry = __builtin_ia32_addcarryx_u64(0, low_, n, &result);
low_ = result; low_ = result;
__builtin_ia32_addcarryx_u64(carry, high_, 0, &result); high_ += carry;
high_ = result;
#elif defined(_MSC_VER) && defined(_M_X64) #elif defined(_MSC_VER) && defined(_M_X64)
auto carry = _addcarry_u64(0, low_, n, &low_); auto carry = _addcarry_u64(0, low_, n, &low_);
_addcarry_u64(carry, high_, 0, &high_); _addcarry_u64(carry, high_, 0, &high_);