Merge pull request #234 from beached/patch-1

Update float_common.h
This commit is contained in:
Daniel Lemire 2023-12-28 08:16:38 -05:00 committed by GitHub
commit 68b9475585
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -284,10 +284,10 @@ uint64_t umul128_generic(uint64_t ab, uint64_t cd, uint64_t *hi) {
uint64_t ad = emulu((uint32_t)(ab >> 32), (uint32_t)cd);
uint64_t bd = emulu((uint32_t)ab, (uint32_t)cd);
uint64_t adbc = ad + emulu((uint32_t)ab, (uint32_t)(cd >> 32));
uint64_t adbc_carry = !!(adbc < ad);
uint64_t adbc_carry = (uint64_t)(adbc < ad);
uint64_t lo = bd + (adbc << 32);
*hi = emulu((uint32_t)(ab >> 32), (uint32_t)(cd >> 32)) + (adbc >> 32) +
(adbc_carry << 32) + !!(lo < bd);
(adbc_carry << 32) + (uint64_t)(lo < bd);
return lo;
}