aboutsummaryrefslogtreecommitdiff
path: root/softfloat/s_roundPackToI32.c
diff options
context:
space:
mode:
authorAndrew Waterman <andrew@sifive.com>2018-07-11 01:16:28 -0700
committerAndrew Waterman <andrew@sifive.com>2018-07-11 01:16:28 -0700
commit5cd8d2b93fad2011fdf8f49a263d77697af35b32 (patch)
treef6fb9cb6d3bef2aa5c9903511b92e5a6e99e9519 /softfloat/s_roundPackToI32.c
parent8e69141749065ff957383d2112768f95a33429b6 (diff)
downloadpk-5cd8d2b93fad2011fdf8f49a263d77697af35b32.zip
pk-5cd8d2b93fad2011fdf8f49a263d77697af35b32.tar.gz
pk-5cd8d2b93fad2011fdf8f49a263d77697af35b32.tar.bz2
Upgrade to SoftFloat 3e
Diffstat (limited to 'softfloat/s_roundPackToI32.c')
-rwxr-xr-xsoftfloat/s_roundPackToI32.c50
1 files changed, 0 insertions, 50 deletions
diff --git a/softfloat/s_roundPackToI32.c b/softfloat/s_roundPackToI32.c
deleted file mode 100755
index c106c6f..0000000
--- a/softfloat/s_roundPackToI32.c
+++ /dev/null
@@ -1,50 +0,0 @@
-// See LICENSE.SoftFloat for license details.
-
-
-#include <stdbool.h>
-#include <stdint.h>
-#include "platform.h"
-#include "internals.h"
-#include "softfloat.h"
-
-int_fast32_t
- softfloat_roundPackToI32(
- bool sign, uint_fast64_t sig, int_fast8_t roundingMode, bool exact )
-{
- bool roundNearestEven;
- int roundIncrement, roundBits;
- uint_fast32_t sig32;
- union { uint32_t ui; int32_t i; } uZ;
- int_fast32_t z;
-
- roundNearestEven = ( roundingMode == softfloat_round_nearest_even );
- roundIncrement = 0x40;
- if (
- ! roundNearestEven
- && ( roundingMode != softfloat_round_nearest_maxMag )
- ) {
- roundIncrement =
- ( roundingMode == softfloat_round_minMag )
- || ( roundingMode
- == ( sign ? softfloat_round_max : softfloat_round_min ) )
- ? 0
- : 0x7F;
- }
- roundBits = sig & 0x7F;
- sig += roundIncrement;
- if ( sig & UINT64_C( 0xFFFFFF8000000000 ) ) goto invalid;
- sig32 = sig>>7;
- sig32 &= ~ ( ! ( roundBits ^ 0x40 ) & roundNearestEven );
- uZ.ui = sign ? - sig32 : sig32;
- z = uZ.i;
- if ( z && ( ( z < 0 ) ^ sign ) ) goto invalid;
- if ( exact && roundBits ) {
- softfloat_raiseFlags( softfloat_flag_inexact );
- }
- return z;
- invalid:
- softfloat_raiseFlags( softfloat_flag_invalid );
- return sign ? -0x7FFFFFFF - 1 : 0x7FFFFFFF;
-
-}
-