-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compilation warning/error with gcc 6.3.0 #117
Comments
Here is the full code dump... template <typename T>
fastfloat_really_inline adjusted_mantissa to_extended(T value) noexcept {
adjusted_mantissa am;
int32_t bias = binary_format<T>::mantissa_explicit_bits() - binary_format<T>::minimum_exponent();
if (std::is_same<T, float>::value) {
constexpr uint32_t exponent_mask = 0x7F800000;
constexpr uint32_t mantissa_mask = 0x007FFFFF;
constexpr uint64_t hidden_bit_mask = 0x00800000;
uint32_t bits;
::memcpy(&bits, &value, sizeof(T));
if ((bits & exponent_mask) == 0) {
// denormal
am.power2 = 1 - bias;
am.mantissa = bits & mantissa_mask;
} else {
// normal
am.power2 = int32_t((bits & exponent_mask) >> binary_format<T>::mantissa_explicit_bits()); // <-------- report is here
am.power2 -= bias;
am.mantissa = (bits & mantissa_mask) | hidden_bit_mask;
}
} else {
constexpr uint64_t exponent_mask = 0x7FF0000000000000;
constexpr uint64_t mantissa_mask = 0x000FFFFFFFFFFFFF;
constexpr uint64_t hidden_bit_mask = 0x0010000000000000;
uint64_t bits;
::memcpy(&bits, &value, sizeof(T));
if ((bits & exponent_mask) == 0) {
// denormal
am.power2 = 1 - bias;
am.mantissa = bits & mantissa_mask;
} else {
// normal
am.power2 = int32_t((bits & exponent_mask) >> binary_format<T>::mantissa_explicit_bits());
am.power2 -= bias;
am.mantissa = (bits & mantissa_mask) | hidden_bit_mask;
}
}
return am;
} |
Right. Since |
@pitrou Does the error go away if you substitute...
for
|
That would also work, of course. |
Would you consider doing a PR? It should be easy and save me the trouble of verifying the fix with you. |
Yes, I'll try to. |
Submitted #118 |
Fix #117: compilation warning with gcc 6.3.0
New release: 3.4.0. |
We just got this after bumping our vendored copy to the latest git master (052975d):
The text was updated successfully, but these errors were encountered: