9 softfloat_roundPackToUI32(
10 bool sign
, uint_fast64_t sig
, int_fast8_t roundingMode
, bool exact
)
12 bool roundNearestEven
;
13 int roundIncrement
, roundBits
;
16 roundNearestEven
= ( roundingMode
== softfloat_round_nearest_even
);
17 roundIncrement
= 0x40;
20 && ( roundingMode
!= softfloat_round_nearest_maxMag
)
23 ( roundingMode
== softfloat_round_minMag
)
25 == ( sign
? softfloat_round_max
: softfloat_round_min
) )
29 roundBits
= sig
& 0x7F;
30 sig
+= roundIncrement
;
31 if ( sig
& UINT64_C( 0xFFFFFF8000000000 ) ) goto invalid
;
33 z
&= ~ ( ! ( roundBits
^ 0x40 ) & roundNearestEven
);
34 if ( sign
&& z
) goto invalid
;
35 if ( exact
&& roundBits
) {
36 softfloat_exceptionFlags
|= softfloat_flag_inexact
;
40 softfloat_raiseFlags( softfloat_flag_invalid
);