diff options
Diffstat (limited to 'fpu')
-rw-r--r-- | fpu/softfloat.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 83ccc4b..7ba51b6 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -3898,9 +3898,15 @@ float64 float64_muladd(float64 a, float64 b, float64 c, int flags STATUS_PARAM) } zExp -= shiftcount; } else { - shiftcount = countLeadingZeros64(zSig1) - 1; - zSig0 = zSig1 << shiftcount; - zExp -= (shiftcount + 64); + shiftcount = countLeadingZeros64(zSig1); + if (shiftcount == 0) { + zSig0 = (zSig1 >> 1) | (zSig1 & 1); + zExp -= 63; + } else { + shiftcount--; + zSig0 = zSig1 << shiftcount; + zExp -= (shiftcount + 64); + } } return roundAndPackFloat64(zSign, zExp, zSig0 STATUS_VAR); } |