X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;ds=sidebyside;f=softfloat%2Ff64_roundToInt.c;h=7f81007082cc019984c7698ccdd62eaf9e39fff5;hb=bd85811c35ea38180d27440507fc222d585ef780;hp=94fe40de86218b7226ea16f3ceab7c790802c80c;hpb=b86f2a51f522f020ad0d90f598f4c501f41da232;p=riscv-isa-sim.git diff --git a/softfloat/f64_roundToInt.c b/softfloat/f64_roundToInt.c index 94fe40d..7f81007 100644 --- a/softfloat/f64_roundToInt.c +++ b/softfloat/f64_roundToInt.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 3d, by John R. Hauser. -Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. -All rights reserved. +Copyright 2011, 2012, 2013, 2014, 2017 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: @@ -94,10 +94,11 @@ float64_t f64_roundToInt( float64_t a, uint_fast8_t roundingMode, bool exact ) } else if ( roundingMode == softfloat_round_near_even ) { uiZ += lastBitMask>>1; if ( ! (uiZ & roundBitsMask) ) uiZ &= ~lastBitMask; - } else if ( roundingMode != softfloat_round_minMag ) { - if ( signF64UI( uiZ ) ^ (roundingMode == softfloat_round_max) ) { - uiZ += roundBitsMask; - } + } else if ( + roundingMode + == (signF64UI( uiZ ) ? softfloat_round_min : softfloat_round_max) + ) { + uiZ += roundBitsMask; } uiZ &= ~roundBitsMask; if ( exact && (uiZ != uiA) ) {