1
0
mirror of https://github.com/dolphin-emu/dolphin synced 2024-07-01 07:54:33 +00:00

Correct Removal of Loop

This both removes certain undefined behavior accidentally caused as well as properly fixing and testing the expression -- I hadn't built and tested the loop removal despite thinking I had before, oops ^^;
This commit is contained in:
Geotale 2024-05-27 18:43:50 -05:00
parent f1a2ea5ae8
commit c0c8252860

View File

@ -102,13 +102,13 @@ inline double Force25Bit(double d)
// at a different bit
s64 keep_mask = 0xFFFFFFFFF8000000LL;
u32 round = 0x8000000;
u64 round = 0x8000000;
// Shift the mask and rounding bit to the right until
// the fraction is "normal"
// That is to say shifting it until the MSB of the fraction
// would escape into the exponent
u32 shift = Common::DOUBLE_FRAC_WIDTH - std::countl_zero(fraction);
u32 shift = std::countl_zero(fraction) + Common::DOUBLE_FRAC_WIDTH - 63;
keep_mask >>= shift;
round >>= shift;