[libc-commits] [libc] 31ed45d - [libc][Obvious] Fix nextafter* implementation.

Siva Chandra Reddy via libc-commits libc-commits at lists.llvm.org
Tue Apr 13 11:38:34 PDT 2021


Author: Siva Chandra Reddy
Date: 2021-04-13T11:38:24-07:00
New Revision: 31ed45d9cfd5da2bf4f1d7ddba54122df6fc91fa

URL: https://github.com/llvm/llvm-project/commit/31ed45d9cfd5da2bf4f1d7ddba54122df6fc91fa
DIFF: https://github.com/llvm/llvm-project/commit/31ed45d9cfd5da2bf4f1d7ddba54122df6fc91fa.diff

LOG: [libc][Obvious] Fix nextafter* implementation.

It broke when FPBits was converted to a union.

Added: 
    

Modified: 
    libc/utils/FPUtil/ManipulationFunctions.h

Removed: 
    


################################################################################
diff  --git a/libc/utils/FPUtil/ManipulationFunctions.h b/libc/utils/FPUtil/ManipulationFunctions.h
index ef8a3775df7bc..f0e5c8faa0a40 100644
--- a/libc/utils/FPUtil/ManipulationFunctions.h
+++ b/libc/utils/FPUtil/ManipulationFunctions.h
@@ -167,7 +167,7 @@ static inline T nextafter(T from, T to) {
       --intVal;
     }
   } else {
-    intVal = (UIntType(toBits) & signMask) + UIntType(1);
+    intVal = (toBits.uintval() & signMask) + UIntType(1);
   }
 
   return *reinterpret_cast<T *>(&intVal);


        


More information about the libc-commits mailing list