diff options
Diffstat (limited to 'ext/fputils/fp80.c')
-rw-r--r-- | ext/fputils/fp80.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/fputils/fp80.c b/ext/fputils/fp80.c index 6ba890480..05acfd91a 100644 --- a/ext/fputils/fp80.c +++ b/ext/fputils/fp80.c @@ -162,7 +162,10 @@ fp80_cvtfp64(fp80_t fp80) * as normals */ return build_fp64(sign, fp64_frac, fp64_exp); } else if (fp64_exp <= 0) { - uint64_t fp64_denormal_frac = fp64_frac >> (-fp64_exp); + uint64_t fp64_denormal_frac = -64 < fp64_exp + // -64 < fp_exp <= 0, so safe to bitshift by -fp_exp + ? fp64_frac >> (-fp64_exp) + : 0; /* Generate a denormal or zero */ return build_fp64(sign, fp64_denormal_frac, 0); } else { |