54 uint64_t sig, roundIncrement, roundMask, roundBits;
66 if ( roundingPrecision == 80 )
goto precision80;
67 if ( roundingPrecision == 64 ) {
68 roundIncrement =
UINT64_C( 0x0000000000000400 );
69 roundMask =
UINT64_C( 0x00000000000007FF );
70 }
else if ( roundingPrecision == 32 ) {
71 roundIncrement =
UINT64_C( 0x0000008000000000 );
72 roundMask =
UINT64_C( 0x000000FFFFFFFFFF );
86 roundBits = sig & roundMask;
89 if ( 0x7FFD <= (
uint32_t) (exp - 1) ) {
97 || (sig <= (
uint64_t) (sig + roundIncrement));
99 roundBits = sig & roundMask;
103#ifdef SOFTFLOAT_ROUND_ODD
105 sig |= roundMask + 1;
109 sig += roundIncrement;
110 exp = ((sig &
UINT64_C( 0x8000000000000000 )) != 0);
111 roundIncrement = roundMask + 1;
112 if ( roundNearEven && (roundBits<<1 == roundIncrement) ) {
113 roundMask |= roundIncrement;
120 || ((exp == 0x7FFE) && ((
uint64_t) (sig + roundIncrement) < sig))
129#ifdef SOFTFLOAT_ROUND_ODD
131 sig = (sig & ~roundMask) | (roundMask + 1);
136 sig += roundIncrement;
137 if ( sig < roundIncrement ) {
139 sig =
UINT64_C( 0x8000000000000000 );
141 roundIncrement = roundMask + 1;
142 if ( roundNearEven && (roundBits<<1 == roundIncrement) ) {
143 roundMask |= roundIncrement;
151 doIncrement = (0x80000000 <= sigExtra);
160 if ( 0x7FFD <= (
uint32_t) (exp - 1) ) {
169 || (sig <
UINT64_C( 0xFFFFFFFFFFFFFFFF ));
179#ifdef SOFTFLOAT_ROUND_ODD
186 doIncrement = (0x80000000 <= sigExtra);
198 sig &= ~(
uint64_t) (! (sigExtra & 0x7FFFFFFF) & roundNearEven);
199 exp = ((sig &
UINT64_C( 0x8000000000000000 )) != 0);
205 || ((exp == 0x7FFE) && (sig ==
UINT64_C( 0xFFFFFFFFFFFFFFFF ))
221 sig =
UINT64_C( 0x8000000000000000 );
233#ifdef SOFTFLOAT_ROUND_ODD
244 sig =
UINT64_C( 0x8000000000000000 );
246 sig &= ~(
uint64_t) (! (sigExtra & 0x7FFFFFFF) & roundNearEven);