Add --disable-dtb option to suppress writing the DTB to memory
[riscv-isa-sim.git] / softfloat / f32_add.c
index 5b5a09e7ca094dd6f81c7a4e2463aa5279139325..4a51eccf68530307a51df76d73e94b8439c9e103 100644 (file)
@@ -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, 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:
@@ -44,30 +44,26 @@ float32_t f32_add( float32_t a, float32_t b )
 {
     union ui32_f32 uA;
     uint_fast32_t uiA;
-    bool signA;
     union ui32_f32 uB;
     uint_fast32_t uiB;
-    bool signB;
 #if ! defined INLINE_LEVEL || (INLINE_LEVEL < 1)
-    float32_t (*magsFuncPtr)( uint_fast32_t, uint_fast32_t, bool );
+    float32_t (*magsFuncPtr)( uint_fast32_t, uint_fast32_t );
 #endif
 
     uA.f = a;
     uiA = uA.ui;
-    signA = signF32UI( uiA );
     uB.f = b;
     uiB = uB.ui;
-    signB = signF32UI( uiB );
 #if defined INLINE_LEVEL && (1 <= INLINE_LEVEL)
-    if ( signA == signB ) {
-        return softfloat_addMagsF32( uiA, uiB, signA );
+    if ( signF32UI( uiA ^ uiB ) ) {
+        return softfloat_subMagsF32( uiA, uiB );
     } else {
-        return softfloat_subMagsF32( uiA, uiB, signA );
+        return softfloat_addMagsF32( uiA, uiB );
     }
 #else
     magsFuncPtr =
-        (signA == signB) ? softfloat_addMagsF32 : softfloat_subMagsF32;
-    return (*magsFuncPtr)( uiA, uiB, signA );
+        signF32UI( uiA ^ uiB ) ? softfloat_subMagsF32 : softfloat_addMagsF32;
+    return (*magsFuncPtr)( uiA, uiB );
 #endif
 
 }