diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2015-09-06 18:41:23 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2015-09-06 18:41:23 +0000 |
commit | f31bcc68c72371a2bf63aead9f3373a1ff2053b6 (patch) | |
tree | b259e5d585da0f8cde9579939a74d5ef44c72abd /lib/builtins/fp_extend_impl.inc | |
parent | cd2dd3df15523e2be8d2bbace27641d6ac9fa40d (diff) |
Notes
Diffstat (limited to 'lib/builtins/fp_extend_impl.inc')
-rw-r--r-- | lib/builtins/fp_extend_impl.inc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/builtins/fp_extend_impl.inc b/lib/builtins/fp_extend_impl.inc index f6953ff4bfae6..edcfa8d2329d1 100644 --- a/lib/builtins/fp_extend_impl.inc +++ b/lib/builtins/fp_extend_impl.inc @@ -66,7 +66,9 @@ static inline dst_t __extendXfYf2__(src_t a) { const src_rep_t sign = aRep & srcSignMask; dst_rep_t absResult; - if (aAbs - srcMinNormal < srcInfinity - srcMinNormal) { + // If sizeof(src_rep_t) < sizeof(int), the subtraction result is promoted + // to (signed) int. To avoid that, explicitly cast to src_rep_t. + if ((src_rep_t)(aAbs - srcMinNormal) < srcInfinity - srcMinNormal) { // a is a normal number. // Extend to the destination type by shifting the significand and // exponent into the proper position and rebiasing the exponent. |