Fix a typo in __fpu_ftox() that caused long double to long (and long long)
conversion of negative numbers to always result in -1. While at it, rearrange the nearby comment so it fits in 80 chars per line, like the rest of this file does. PR: 107130 MFC after: 1 day
This commit is contained in:
parent
30b466801f
commit
7bebf7360d
@ -259,14 +259,15 @@ __fpu_ftox(fe, fp, res)
|
||||
|
||||
case FPC_NUM:
|
||||
/*
|
||||
* If exp >= 2^64, overflow. Otherwise shift value right
|
||||
* into last mantissa word (this will not exceed 0xffffffffffffffff),
|
||||
* shifting any guard and round bits out into the sticky
|
||||
* bit. Then ``round'' towards zero, i.e., just set an
|
||||
* inexact exception if sticky is set (see round()).
|
||||
* If the result is > 0x8000000000000000, or is positive and equals
|
||||
* 0x8000000000000000, overflow; otherwise the last fraction word
|
||||
* is the result.
|
||||
* If exp >= 2^64, overflow. Otherwise shift value
|
||||
* right into last mantissa word (this will not exceed
|
||||
* 0xffffffffffffffff), shifting any guard and round
|
||||
* bits out into the sticky bit. Then ``round'' towards
|
||||
* zero, i.e., just set an inexact exception if sticky
|
||||
* is set (see round()).
|
||||
* If the result is > 0x8000000000000000, or is positive
|
||||
* and equals 0x8000000000000000, overflow; otherwise
|
||||
* the last fraction word is the result.
|
||||
*/
|
||||
if ((exp = fp->fp_exp) >= 64)
|
||||
break;
|
||||
@ -277,7 +278,7 @@ __fpu_ftox(fe, fp, res)
|
||||
if (i >= ((u_int64_t)0x8000000000000000LL + sign))
|
||||
break;
|
||||
if (sign)
|
||||
i = -1;
|
||||
i = -i;
|
||||
res[1] = (int)i;
|
||||
return (i >> 32);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user