common/fp/op/FPConvert: Amend off-by one in double NaN case in FPConvertNaN

Avoids potentially clobbering the intended sign bit value during
conversions to double-precision values. The other conversion types are
already properly handled, so those don't need to be addressed.
This commit is contained in:
Lioncash 2019-03-23 12:14:08 -04:00
parent 29e1a024c7
commit 36e739ba9b
No known key found for this signature in database
GPG Key ID: 4E3C3CC1031BA9C7

View File

@ -35,7 +35,7 @@ FPT_TO FPConvertNaN(FPT_FROM op) {
const u64 exponent = Common::Ones<u64>(dest_bit_size - FPInfo<FPT_TO>::explicit_mantissa_width);
if constexpr (sizeof(FPT_TO) == sizeof(u64)) {
return FPT_TO(shifted_sign | exponent << 52 | frac);
return FPT_TO(shifted_sign | exponent << 51 | frac);
} else if constexpr (sizeof(FPT_TO) == sizeof(u32)) {
return FPT_TO(shifted_sign | exponent << 22 | Common::Bits<29, 50>(frac));
} else {