int8 roundIncrement, roundBits;
int32_t z;
- roundingMode = STATUS(float_rounding_mode);
+ roundingMode = status->float_rounding_mode;
roundNearestEven = ( roundingMode == float_round_nearest_even );
switch (roundingMode) {
case float_round_nearest_even:
float_raise(float_flag_invalid, status);
return zSign ? (int32_t) 0x80000000 : 0x7FFFFFFF;
}
- if ( roundBits ) STATUS(float_exception_flags) |= float_flag_inexact;
+ if (roundBits) {
+ status->float_exception_flags |= float_flag_inexact;
+ }
return z;
}
flag roundNearestEven, increment;
int64_t z;
- roundingMode = STATUS(float_rounding_mode);
+ roundingMode = status->float_rounding_mode;
roundNearestEven = ( roundingMode == float_round_nearest_even );
switch (roundingMode) {
case float_round_nearest_even:
zSign ? (int64_t) LIT64( 0x8000000000000000 )
: LIT64( 0x7FFFFFFFFFFFFFFF );
}
- if ( absZ1 ) STATUS(float_exception_flags) |= float_flag_inexact;
+ if (absZ1) {
+ status->float_exception_flags |= float_flag_inexact;
+ }
return z;
}
int8 roundingMode;
flag roundNearestEven, increment;
- roundingMode = STATUS(float_rounding_mode);
+ roundingMode = status->float_rounding_mode;
roundNearestEven = (roundingMode == float_round_nearest_even);
switch (roundingMode) {
case float_round_nearest_even:
}
if (absZ1) {
- STATUS(float_exception_flags) |= float_flag_inexact;
+ status->float_exception_flags |= float_flag_inexact;
}
return absZ0;
}
*----------------------------------------------------------------------------*/
float32 float32_squash_input_denormal(float32 a, float_status *status)
{
- if (STATUS(flush_inputs_to_zero)) {
+ if (status->flush_inputs_to_zero) {
if (extractFloat32Exp(a) == 0 && extractFloat32Frac(a) != 0) {
float_raise(float_flag_input_denormal, status);
return make_float32(float32_val(a) & 0x80000000);
int8 roundIncrement, roundBits;
flag isTiny;
- roundingMode = STATUS(float_rounding_mode);
+ roundingMode = status->float_rounding_mode;
roundNearestEven = ( roundingMode == float_round_nearest_even );
switch (roundingMode) {
case float_round_nearest_even:
return packFloat32( zSign, 0xFF, - ( roundIncrement == 0 ));
}
if ( zExp < 0 ) {
- if (STATUS(flush_to_zero)) {
+ if (status->flush_to_zero) {
float_raise(float_flag_output_denormal, status);
return packFloat32(zSign, 0, 0);
}
isTiny =
- ( STATUS(float_detect_tininess) == float_tininess_before_rounding )
+ (status->float_detect_tininess
+ == float_tininess_before_rounding)
|| ( zExp < -1 )
|| ( zSig + roundIncrement < 0x80000000 );
shift32RightJamming( zSig, - zExp, &zSig );
}
}
}
- if ( roundBits ) STATUS(float_exception_flags) |= float_flag_inexact;
+ if (roundBits) {
+ status->float_exception_flags |= float_flag_inexact;
+ }
zSig = ( zSig + roundIncrement )>>7;
zSig &= ~ ( ( ( roundBits ^ 0x40 ) == 0 ) & roundNearestEven );
if ( zSig == 0 ) zExp = 0;
*----------------------------------------------------------------------------*/
float64 float64_squash_input_denormal(float64 a, float_status *status)
{
- if (STATUS(flush_inputs_to_zero)) {
+ if (status->flush_inputs_to_zero) {
if (extractFloat64Exp(a) == 0 && extractFloat64Frac(a) != 0) {
float_raise(float_flag_input_denormal, status);
return make_float64(float64_val(a) & (1ULL << 63));
int_fast16_t roundIncrement, roundBits;
flag isTiny;
- roundingMode = STATUS(float_rounding_mode);
+ roundingMode = status->float_rounding_mode;
roundNearestEven = ( roundingMode == float_round_nearest_even );
switch (roundingMode) {
case float_round_nearest_even:
return packFloat64( zSign, 0x7FF, - ( roundIncrement == 0 ));
}
if ( zExp < 0 ) {
- if (STATUS(flush_to_zero)) {
+ if (status->flush_to_zero) {
float_raise(float_flag_output_denormal, status);
return packFloat64(zSign, 0, 0);
}
isTiny =
- ( STATUS(float_detect_tininess) == float_tininess_before_rounding )
+ (status->float_detect_tininess
+ == float_tininess_before_rounding)
|| ( zExp < -1 )
|| ( zSig + roundIncrement < LIT64( 0x8000000000000000 ) );
shift64RightJamming( zSig, - zExp, &zSig );
}
}
}
- if ( roundBits ) STATUS(float_exception_flags) |= float_flag_inexact;
+ if (roundBits) {
+ status->float_exception_flags |= float_flag_inexact;
+ }
zSig = ( zSig + roundIncrement )>>10;
zSig &= ~ ( ( ( roundBits ^ 0x200 ) == 0 ) & roundNearestEven );
if ( zSig == 0 ) zExp = 0;
flag roundNearestEven, increment, isTiny;
int64 roundIncrement, roundMask, roundBits;
- roundingMode = STATUS(float_rounding_mode);
+ roundingMode = status->float_rounding_mode;
roundNearestEven = ( roundingMode == float_round_nearest_even );
if ( roundingPrecision == 80 ) goto precision80;
if ( roundingPrecision == 64 ) {
goto overflow;
}
if ( zExp <= 0 ) {
- if (STATUS(flush_to_zero)) {
+ if (status->flush_to_zero) {
float_raise(float_flag_output_denormal, status);
return packFloatx80(zSign, 0, 0);
}
isTiny =
- ( STATUS(float_detect_tininess) == float_tininess_before_rounding )
+ (status->float_detect_tininess
+ == float_tininess_before_rounding)
|| ( zExp < 0 )
|| ( zSig0 <= zSig0 + roundIncrement );
shift64RightJamming( zSig0, 1 - zExp, &zSig0 );
if (isTiny && roundBits) {
float_raise(float_flag_underflow, status);
}
- if ( roundBits ) STATUS(float_exception_flags) |= float_flag_inexact;
+ if (roundBits) {
+ status->float_exception_flags |= float_flag_inexact;
+ }
zSig0 += roundIncrement;
if ( (int64_t) zSig0 < 0 ) zExp = 1;
roundIncrement = roundMask + 1;
return packFloatx80( zSign, zExp, zSig0 );
}
}
- if ( roundBits ) STATUS(float_exception_flags) |= float_flag_inexact;
+ if (roundBits) {
+ status->float_exception_flags |= float_flag_inexact;
+ }
zSig0 += roundIncrement;
if ( zSig0 < roundIncrement ) {
++zExp;
}
if ( zExp <= 0 ) {
isTiny =
- ( STATUS(float_detect_tininess) == float_tininess_before_rounding )
+ (status->float_detect_tininess
+ == float_tininess_before_rounding)
|| ( zExp < 0 )
|| ! increment
|| ( zSig0 < LIT64( 0xFFFFFFFFFFFFFFFF ) );
if (isTiny && zSig1) {
float_raise(float_flag_underflow, status);
}
- if ( zSig1 ) STATUS(float_exception_flags) |= float_flag_inexact;
+ if (zSig1) {
+ status->float_exception_flags |= float_flag_inexact;
+ }
switch (roundingMode) {
case float_round_nearest_even:
case float_round_ties_away:
return packFloatx80( zSign, zExp, zSig0 );
}
}
- if ( zSig1 ) STATUS(float_exception_flags) |= float_flag_inexact;
+ if (zSig1) {
+ status->float_exception_flags |= float_flag_inexact;
+ }
if ( increment ) {
++zSig0;
if ( zSig0 == 0 ) {
int8 roundingMode;
flag roundNearestEven, increment, isTiny;
- roundingMode = STATUS(float_rounding_mode);
+ roundingMode = status->float_rounding_mode;
roundNearestEven = ( roundingMode == float_round_nearest_even );
switch (roundingMode) {
case float_round_nearest_even:
return packFloat128( zSign, 0x7FFF, 0, 0 );
}
if ( zExp < 0 ) {
- if (STATUS(flush_to_zero)) {
+ if (status->flush_to_zero) {
float_raise(float_flag_output_denormal, status);
return packFloat128(zSign, 0, 0, 0);
}
isTiny =
- ( STATUS(float_detect_tininess) == float_tininess_before_rounding )
+ (status->float_detect_tininess
+ == float_tininess_before_rounding)
|| ( zExp < -1 )
|| ! increment
|| lt128(
}
}
}
- if ( zSig2 ) STATUS(float_exception_flags) |= float_flag_inexact;
+ if (zSig2) {
+ status->float_exception_flags |= float_flag_inexact;
+ }
if ( increment ) {
add128( zSig0, zSig1, 0, 1, &zSig0, &zSig1 );
zSig1 &= ~ ( ( zSig2 + zSig2 == 0 ) & roundNearestEven );
return (int32_t) 0x80000000;
}
else if ( aExp <= 0x7E ) {
- if ( aExp | aSig ) STATUS(float_exception_flags) |= float_flag_inexact;
+ if (aExp | aSig) {
+ status->float_exception_flags |= float_flag_inexact;
+ }
return 0;
}
aSig = ( aSig | 0x00800000 )<<8;
z = aSig>>( - shiftCount );
if ( (uint32_t) ( aSig<<( shiftCount & 31 ) ) ) {
- STATUS(float_exception_flags) |= float_flag_inexact;
+ status->float_exception_flags |= float_flag_inexact;
}
if ( aSign ) z = - z;
return z;
}
else if ( aExp <= 0x7E ) {
if ( aExp | aSig ) {
- STATUS(float_exception_flags) |= float_flag_inexact;
+ status->float_exception_flags |= float_flag_inexact;
}
return 0;
}
aSig = ( aSig | 0x00800000 )<<8;
z = aSig>>( - shiftCount );
if ( (uint32_t) ( aSig<<( shiftCount & 31 ) ) ) {
- STATUS(float_exception_flags) |= float_flag_inexact;
+ status->float_exception_flags |= float_flag_inexact;
}
if ( aSign ) {
z = - z;
uint64 float32_to_uint64_round_to_zero(float32 a, float_status *status)
{
- signed char current_rounding_mode = STATUS(float_rounding_mode);
+ signed char current_rounding_mode = status->float_rounding_mode;
set_float_rounding_mode(float_round_to_zero, status);
int64_t v = float32_to_uint64(a, status);
set_float_rounding_mode(current_rounding_mode, status);
return (int64_t) LIT64( 0x8000000000000000 );
}
else if ( aExp <= 0x7E ) {
- if ( aExp | aSig ) STATUS(float_exception_flags) |= float_flag_inexact;
+ if (aExp | aSig) {
+ status->float_exception_flags |= float_flag_inexact;
+ }
return 0;
}
aSig64 = aSig | 0x00800000;
aSig64 <<= 40;
z = aSig64>>( - shiftCount );
if ( (uint64_t) ( aSig64<<( shiftCount & 63 ) ) ) {
- STATUS(float_exception_flags) |= float_flag_inexact;
+ status->float_exception_flags |= float_flag_inexact;
}
if ( aSign ) z = - z;
return z;
}
if ( aExp <= 0x7E ) {
if ( (uint32_t) ( float32_val(a)<<1 ) == 0 ) return a;
- STATUS(float_exception_flags) |= float_flag_inexact;
+ status->float_exception_flags |= float_flag_inexact;
aSign = extractFloat32Sign( a );
- switch ( STATUS(float_rounding_mode) ) {
+ switch (status->float_rounding_mode) {
case float_round_nearest_even:
if ( ( aExp == 0x7E ) && extractFloat32Frac( a ) ) {
return packFloat32( aSign, 0x7F, 0 );
lastBitMask <<= 0x96 - aExp;
roundBitsMask = lastBitMask - 1;
z = float32_val(a);
- switch (STATUS(float_rounding_mode)) {
+ switch (status->float_rounding_mode) {
case float_round_nearest_even:
z += lastBitMask>>1;
if ((z & roundBitsMask) == 0) {
abort();
}
z &= ~ roundBitsMask;
- if ( z != float32_val(a) ) STATUS(float_exception_flags) |= float_flag_inexact;
+ if (z != float32_val(a)) {
+ status->float_exception_flags |= float_flag_inexact;
+ }
return make_float32(z);
}
return a;
}
if ( aExp == 0 ) {
- if (STATUS(flush_to_zero)) {
+ if (status->flush_to_zero) {
if (aSig | bSig) {
float_raise(float_flag_output_denormal, status);
}
}
if ( bSig < aSig ) goto aBigger;
if ( aSig < bSig ) goto bBigger;
- return packFloat32( STATUS(float_rounding_mode) == float_round_down, 0, 0 );
+ return packFloat32(status->float_rounding_mode == float_round_down, 0, 0);
bExpBigger:
if ( bExp == 0xFF ) {
if (bSig) {
/* Adding two exact zeroes */
if (pSign == cSign) {
zSign = pSign;
- } else if (STATUS(float_rounding_mode) == float_round_down) {
+ } else if (status->float_rounding_mode == float_round_down) {
zSign = 1;
} else {
zSign = 0;
return packFloat32(zSign ^ signflip, 0, 0);
}
/* Exact zero plus a denorm */
- if (STATUS(flush_to_zero)) {
+ if (status->flush_to_zero) {
float_raise(float_flag_output_denormal, status);
return packFloat32(cSign ^ signflip, 0, 0);
}
} else {
/* Exact zero */
zSign = signflip;
- if (STATUS(float_rounding_mode) == float_round_down) {
+ if (status->float_rounding_mode == float_round_down) {
zSign ^= 1;
}
return packFloat32(zSign, 0, 0);
goto invalid;
}
else if ( aExp < 0x3FF ) {
- if ( aExp || aSig ) STATUS(float_exception_flags) |= float_flag_inexact;
+ if (aExp || aSig) {
+ status->float_exception_flags |= float_flag_inexact;
+ }
return 0;
}
aSig |= LIT64( 0x0010000000000000 );
return aSign ? (int32_t) 0x80000000 : 0x7FFFFFFF;
}
if ( ( aSig<<shiftCount ) != savedASig ) {
- STATUS(float_exception_flags) |= float_flag_inexact;
+ status->float_exception_flags |= float_flag_inexact;
}
return z;
}
else if ( aExp < 0x3FF ) {
if ( aExp || aSig ) {
- STATUS(float_exception_flags) |= float_flag_inexact;
+ status->float_exception_flags |= float_flag_inexact;
}
return 0;
}
return aSign ? (int32_t) 0xffff8000 : 0x7FFF;
}
if ( ( aSig<<shiftCount ) != savedASig ) {
- STATUS(float_exception_flags) |= float_flag_inexact;
+ status->float_exception_flags |= float_flag_inexact;
}
return z;
}
}
else {
if ( aExp < 0x3FE ) {
- if ( aExp | aSig ) STATUS(float_exception_flags) |= float_flag_inexact;
+ if (aExp | aSig) {
+ status->float_exception_flags |= float_flag_inexact;
+ }
return 0;
}
z = aSig>>( - shiftCount );
if ( (uint64_t) ( aSig<<( shiftCount & 63 ) ) ) {
- STATUS(float_exception_flags) |= float_flag_inexact;
+ status->float_exception_flags |= float_flag_inexact;
}
}
if ( aSign ) z = - z;
mask = 0x00001fff;
}
- switch (STATUS(float_rounding_mode)) {
+ switch (status->float_rounding_mode) {
case float_round_nearest_even:
increment = (mask + 1) >> 1;
if ((zSig & mask) == increment) {
if (zExp < 0) {
/* Note that flush-to-zero does not affect half-precision results */
is_tiny =
- (STATUS(float_detect_tininess) == float_tininess_before_rounding)
+ (status->float_detect_tininess == float_tininess_before_rounding)
|| (zExp < -1)
|| (!rounding_bumps_exp);
}
}
if ( aExp < 0x3FF ) {
if ( (uint64_t) ( float64_val(a)<<1 ) == 0 ) return a;
- STATUS(float_exception_flags) |= float_flag_inexact;
+ status->float_exception_flags |= float_flag_inexact;
aSign = extractFloat64Sign( a );
- switch ( STATUS(float_rounding_mode) ) {
+ switch (status->float_rounding_mode) {
case float_round_nearest_even:
if ( ( aExp == 0x3FE ) && extractFloat64Frac( a ) ) {
return packFloat64( aSign, 0x3FF, 0 );
lastBitMask <<= 0x433 - aExp;
roundBitsMask = lastBitMask - 1;
z = float64_val(a);
- switch (STATUS(float_rounding_mode)) {
+ switch (status->float_rounding_mode) {
case float_round_nearest_even:
z += lastBitMask >> 1;
if ((z & roundBitsMask) == 0) {
abort();
}
z &= ~ roundBitsMask;
- if ( z != float64_val(a) )
- STATUS(float_exception_flags) |= float_flag_inexact;
+ if (z != float64_val(a)) {
+ status->float_exception_flags |= float_flag_inexact;
+ }
return make_float64(z);
}
{
int oldmode;
float64 res;
- oldmode = STATUS(float_rounding_mode);
- STATUS(float_rounding_mode) = float_round_to_zero;
+ oldmode = status->float_rounding_mode;
+ status->float_rounding_mode = float_round_to_zero;
res = float64_round_to_int(a, status);
- STATUS(float_rounding_mode) = oldmode;
+ status->float_rounding_mode = oldmode;
return res;
}
return a;
}
if ( aExp == 0 ) {
- if (STATUS(flush_to_zero)) {
+ if (status->flush_to_zero) {
if (aSig | bSig) {
float_raise(float_flag_output_denormal, status);
}
}
if ( bSig < aSig ) goto aBigger;
if ( aSig < bSig ) goto bBigger;
- return packFloat64( STATUS(float_rounding_mode) == float_round_down, 0, 0 );
+ return packFloat64(status->float_rounding_mode == float_round_down, 0, 0);
bExpBigger:
if ( bExp == 0x7FF ) {
if (bSig) {
/* Adding two exact zeroes */
if (pSign == cSign) {
zSign = pSign;
- } else if (STATUS(float_rounding_mode) == float_round_down) {
+ } else if (status->float_rounding_mode == float_round_down) {
zSign = 1;
} else {
zSign = 0;
return packFloat64(zSign ^ signflip, 0, 0);
}
/* Exact zero plus a denorm */
- if (STATUS(flush_to_zero)) {
+ if (status->flush_to_zero) {
float_raise(float_flag_output_denormal, status);
return packFloat64(cSign ^ signflip, 0, 0);
}
} else {
/* Exact zero */
zSign = signflip;
- if (STATUS(float_rounding_mode) == float_round_down) {
+ if (status->float_rounding_mode == float_round_down) {
zSign ^= 1;
}
return packFloat64(zSign, 0, 0);
goto invalid;
}
else if ( aExp < 0x3FFF ) {
- if ( aExp || aSig ) STATUS(float_exception_flags) |= float_flag_inexact;
+ if (aExp || aSig) {
+ status->float_exception_flags |= float_flag_inexact;
+ }
return 0;
}
shiftCount = 0x403E - aExp;
return aSign ? (int32_t) 0x80000000 : 0x7FFFFFFF;
}
if ( ( aSig<<shiftCount ) != savedASig ) {
- STATUS(float_exception_flags) |= float_flag_inexact;
+ status->float_exception_flags |= float_flag_inexact;
}
return z;
return (int64_t) LIT64( 0x8000000000000000 );
}
else if ( aExp < 0x3FFF ) {
- if ( aExp | aSig ) STATUS(float_exception_flags) |= float_flag_inexact;
+ if (aExp | aSig) {
+ status->float_exception_flags |= float_flag_inexact;
+ }
return 0;
}
z = aSig>>( - shiftCount );
if ( (uint64_t) ( aSig<<( shiftCount & 63 ) ) ) {
- STATUS(float_exception_flags) |= float_flag_inexact;
+ status->float_exception_flags |= float_flag_inexact;
}
if ( aSign ) z = - z;
return z;
&& ( (uint64_t) ( extractFloatx80Frac( a )<<1 ) == 0 ) ) {
return a;
}
- STATUS(float_exception_flags) |= float_flag_inexact;
+ status->float_exception_flags |= float_flag_inexact;
aSign = extractFloatx80Sign( a );
- switch ( STATUS(float_rounding_mode) ) {
+ switch (status->float_rounding_mode) {
case float_round_nearest_even:
if ( ( aExp == 0x3FFE ) && (uint64_t) ( extractFloatx80Frac( a )<<1 )
) {
lastBitMask <<= 0x403E - aExp;
roundBitsMask = lastBitMask - 1;
z = a;
- switch (STATUS(float_rounding_mode)) {
+ switch (status->float_rounding_mode) {
case float_round_nearest_even:
z.low += lastBitMask>>1;
if ((z.low & roundBitsMask) == 0) {
++z.high;
z.low = LIT64( 0x8000000000000000 );
}
- if ( z.low != a.low ) STATUS(float_exception_flags) |= float_flag_inexact;
+ if (z.low != a.low) {
+ status->float_exception_flags |= float_flag_inexact;
+ }
return z;
}
zSig0 |= LIT64( 0x8000000000000000 );
++zExp;
roundAndPack:
- return roundAndPackFloatx80(STATUS(floatx80_rounding_precision),
+ return roundAndPackFloatx80(status->floatx80_rounding_precision,
zSign, zExp, zSig0, zSig1, status);
}
zSig1 = 0;
if ( bSig < aSig ) goto aBigger;
if ( aSig < bSig ) goto bBigger;
- return packFloatx80( STATUS(float_rounding_mode) == float_round_down, 0, 0 );
+ return packFloatx80(status->float_rounding_mode == float_round_down, 0, 0);
bExpBigger:
if ( bExp == 0x7FFF ) {
if ((uint64_t)(bSig << 1)) {
sub128( aSig, 0, bSig, zSig1, &zSig0, &zSig1 );
zExp = aExp;
normalizeRoundAndPack:
- return normalizeRoundAndPackFloatx80(STATUS(floatx80_rounding_precision),
+ return normalizeRoundAndPackFloatx80(status->floatx80_rounding_precision,
zSign, zExp, zSig0, zSig1, status);
}
shortShift128Left( zSig0, zSig1, 1, &zSig0, &zSig1 );
--zExp;
}
- return roundAndPackFloatx80(STATUS(floatx80_rounding_precision),
+ return roundAndPackFloatx80(status->floatx80_rounding_precision,
zSign, zExp, zSig0, zSig1, status);
}
}
zSig1 |= ( ( rem1 | rem2 ) != 0 );
}
- return roundAndPackFloatx80(STATUS(floatx80_rounding_precision),
+ return roundAndPackFloatx80(status->floatx80_rounding_precision,
zSign, zExp, zSig0, zSig1, status);
}
}
shortShift128Left( 0, zSig1, 1, &zSig0, &zSig1 );
zSig0 |= doubleZSig0;
- return
- roundAndPackFloatx80(
- STATUS(floatx80_rounding_precision), 0, zExp, zSig0, zSig1, status);
-
+ return roundAndPackFloatx80(status->floatx80_rounding_precision,
+ 0, zExp, zSig0, zSig1, status);
}
/*----------------------------------------------------------------------------
goto invalid;
}
else if ( aExp < 0x3FFF ) {
- if ( aExp || aSig0 ) STATUS(float_exception_flags) |= float_flag_inexact;
+ if (aExp || aSig0) {
+ status->float_exception_flags |= float_flag_inexact;
+ }
return 0;
}
aSig0 |= LIT64( 0x0001000000000000 );
return aSign ? (int32_t) 0x80000000 : 0x7FFFFFFF;
}
if ( ( aSig0<<shiftCount ) != savedASig ) {
- STATUS(float_exception_flags) |= float_flag_inexact;
+ status->float_exception_flags |= float_flag_inexact;
}
return z;
aSig0 &= LIT64( 0x0000FFFFFFFFFFFF );
if ( ( a.high == LIT64( 0xC03E000000000000 ) )
&& ( aSig1 < LIT64( 0x0002000000000000 ) ) ) {
- if ( aSig1 ) STATUS(float_exception_flags) |= float_flag_inexact;
+ if (aSig1) {
+ status->float_exception_flags |= float_flag_inexact;
+ }
}
else {
float_raise(float_flag_invalid, status);
}
z = ( aSig0<<shiftCount ) | ( aSig1>>( ( - shiftCount ) & 63 ) );
if ( (uint64_t) ( aSig1<<shiftCount ) ) {
- STATUS(float_exception_flags) |= float_flag_inexact;
+ status->float_exception_flags |= float_flag_inexact;
}
}
else {
if ( aExp < 0x3FFF ) {
if ( aExp | aSig0 | aSig1 ) {
- STATUS(float_exception_flags) |= float_flag_inexact;
+ status->float_exception_flags |= float_flag_inexact;
}
return 0;
}
z = aSig0>>( - shiftCount );
if ( aSig1
|| ( shiftCount && (uint64_t) ( aSig0<<( shiftCount & 63 ) ) ) ) {
- STATUS(float_exception_flags) |= float_flag_inexact;
+ status->float_exception_flags |= float_flag_inexact;
}
}
if ( aSign ) z = - z;
lastBitMask = ( lastBitMask<<( 0x406E - aExp ) )<<1;
roundBitsMask = lastBitMask - 1;
z = a;
- switch (STATUS(float_rounding_mode)) {
+ switch (status->float_rounding_mode) {
case float_round_nearest_even:
if ( lastBitMask ) {
add128( z.high, z.low, 0, lastBitMask>>1, &z.high, &z.low );
else {
if ( aExp < 0x3FFF ) {
if ( ( ( (uint64_t) ( a.high<<1 ) ) | a.low ) == 0 ) return a;
- STATUS(float_exception_flags) |= float_flag_inexact;
+ status->float_exception_flags |= float_flag_inexact;
aSign = extractFloat128Sign( a );
- switch ( STATUS(float_rounding_mode) ) {
+ switch (status->float_rounding_mode) {
case float_round_nearest_even:
if ( ( aExp == 0x3FFE )
&& ( extractFloat128Frac0( a )
roundBitsMask = lastBitMask - 1;
z.low = 0;
z.high = a.high;
- switch (STATUS(float_rounding_mode)) {
+ switch (status->float_rounding_mode) {
case float_round_nearest_even:
z.high += lastBitMask>>1;
if ( ( ( z.high & roundBitsMask ) | a.low ) == 0 ) {
z.high &= ~ roundBitsMask;
}
if ( ( z.low != a.low ) || ( z.high != a.high ) ) {
- STATUS(float_exception_flags) |= float_flag_inexact;
+ status->float_exception_flags |= float_flag_inexact;
}
return z;
}
add128( aSig0, aSig1, bSig0, bSig1, &zSig0, &zSig1 );
if ( aExp == 0 ) {
- if (STATUS(flush_to_zero)) {
+ if (status->flush_to_zero) {
if (zSig0 | zSig1) {
float_raise(float_flag_output_denormal, status);
}
if ( aSig0 < bSig0 ) goto bBigger;
if ( bSig1 < aSig1 ) goto aBigger;
if ( aSig1 < bSig1 ) goto bBigger;
- return packFloat128( STATUS(float_rounding_mode) == float_round_down, 0, 0, 0 );
+ return packFloat128(status->float_rounding_mode == float_round_down,
+ 0, 0, 0);
bExpBigger:
if ( bExp == 0x7FFF ) {
if (bSig0 | bSig1) {
uint64_t float64_to_uint64_round_to_zero(float64 a, float_status *status)
{
- signed char current_rounding_mode = STATUS(float_rounding_mode);
+ signed char current_rounding_mode = status->float_rounding_mode;
set_float_rounding_mode(float_round_to_zero, status);
int64_t v = float64_to_uint64(a, status);
set_float_rounding_mode(current_rounding_mode, status);
}
aExp += n;
- return normalizeRoundAndPackFloatx80( STATUS(floatx80_rounding_precision),
- aSign, aExp, aSig, 0, status);
+ return normalizeRoundAndPackFloatx80(status->floatx80_rounding_precision,
+ aSign, aExp, aSig, 0, status);
}
float128 float128_scalbn(float128 a, int n, float_status *status)