diff options
author | John Hauser <jhauser@eecs.berkeley.edu> | 2016-02-22 15:51:12 -0800 |
---|---|---|
committer | John Hauser <jhauser@eecs.berkeley.edu> | 2016-02-22 15:51:12 -0800 |
commit | 45fdcf1c6583e4af380b147ac568f5aa721b7ba8 (patch) | |
tree | 844650fe6e692766e725deaed8149125895cbc4b /source/s_roundPackMToUI64.c | |
parent | 9dc9d10297e1d43e10188b5b19e2b697216fba2b (diff) | |
download | berkeley-softfloat-3-45fdcf1c6583e4af380b147ac568f5aa721b7ba8.zip berkeley-softfloat-3-45fdcf1c6583e4af380b147ac568f5aa721b7ba8.tar.gz berkeley-softfloat-3-45fdcf1c6583e4af380b147ac568f5aa721b7ba8.tar.bz2 |
Added the ability to specify the result values delivered when conversions
from floating-point to an integer format raise an invalid exception.
For the provided specializations (8086 and RISC-V), changed the result
of converting a negative floating-point value to an unsigned integer
format to now be zero. (Also renamed `shiftCount' inside functions to
`shiftDist'.)
Diffstat (limited to 'source/s_roundPackMToUI64.c')
-rw-r--r-- | source/s_roundPackMToUI64.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/source/s_roundPackMToUI64.c b/source/s_roundPackMToUI64.c index 0a57437..1a64fdf 100644 --- a/source/s_roundPackMToUI64.c +++ b/source/s_roundPackMToUI64.c @@ -2,10 +2,10 @@ /*============================================================================ This C source file is part of the SoftFloat IEEE Floating-Point Arithmetic -Package, Release 3a, by John R. Hauser. +Package, Release 3a+, by John R. Hauser. -Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. -All rights reserved. +Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of +California. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -38,6 +38,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <stdint.h> #include "platform.h" #include "internals.h" +#include "specialize.h" #include "softfloat.h" uint_fast64_t @@ -49,6 +50,8 @@ uint_fast64_t bool doIncrement; uint64_t sig; + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ roundNearEven = (roundingMode == softfloat_round_near_even); sigExtra = extSigPtr[indexWordLo( 3 )]; doIncrement = (0x80000000 <= sigExtra); @@ -71,9 +74,11 @@ uint_fast64_t softfloat_exceptionFlags |= softfloat_flag_inexact; } return sig; + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ invalid: softfloat_raiseFlags( softfloat_flag_invalid ); - return UINT64_C( 0xFFFFFFFFFFFFFFFF ); + return sign ? ui64_fromNegOverflow : ui64_fromPosOverflow; } |