Merge pull request #29 from lemire/dlemire/minor_simplification

Minor simplification.
This commit is contained in:
Daniel Lemire 2020-11-10 21:49:13 -05:00 committed by GitHub
commit 7eae925b51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -107,9 +107,8 @@ adjusted_mantissa compute_float(int64_t q, uint64_t w) noexcept {
uint64_t upperbit = product.high >> 63; uint64_t upperbit = product.high >> 63;
answer.mantissa = product.high >> (upperbit + 64 - binary::mantissa_explicit_bits() - 3); answer.mantissa = product.high >> (upperbit + 64 - binary::mantissa_explicit_bits() - 3);
lz += int(1 ^ upperbit);
answer.power2 = power(int(q)) - lz - binary::minimum_exponent() + 1; answer.power2 = power(int(q)) + upperbit - lz - binary::minimum_exponent();
if (answer.power2 <= 0) { // we have a subnormal? if (answer.power2 <= 0) { // we have a subnormal?
// Here have that answer.power2 <= 0 so -answer.power2 >= 0 // Here have that answer.power2 <= 0 so -answer.power2 >= 0
if(-answer.power2 + 1 >= 64) { // if we have more than 64 bits below the minimum exponent, you have a zero for sure. if(-answer.power2 + 1 >= 64) { // if we have more than 64 bits below the minimum exponent, you have a zero for sure.