[libc-commits] [libc] 5c6db1d - [libc] Fix nested namespace issues with multiply_add.h.

Tue Ly via libc-commits libc-commits at lists.llvm.org
Mon Apr 11 14:30:20 PDT 2022


Author: Tue Ly
Date: 2022-04-11T17:30:02-04:00
New Revision: 5c6db1dc9b839b2e37c115c12fb1aed0bc877671

URL: https://github.com/llvm/llvm-project/commit/5c6db1dc9b839b2e37c115c12fb1aed0bc877671
DIFF: https://github.com/llvm/llvm-project/commit/5c6db1dc9b839b2e37c115c12fb1aed0bc877671.diff

LOG: [libc] Fix nested namespace issues with multiply_add.h.

The FMA header was included inside namespaces in multiply_add.h.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D123539

Added: 
    

Modified: 
    libc/src/__support/FPUtil/multiply_add.h

Removed: 
    


################################################################################
diff  --git a/libc/src/__support/FPUtil/multiply_add.h b/libc/src/__support/FPUtil/multiply_add.h
index 8f5da22a53cb1..b7889c63871c0 100644
--- a/libc/src/__support/FPUtil/multiply_add.h
+++ b/libc/src/__support/FPUtil/multiply_add.h
@@ -22,10 +22,17 @@ template <typename T> static inline T multiply_add(T x, T y, T z) {
   return x * y + z;
 }
 
+} // namespace fputil
+} // namespace __llvm_libc
+
 #if defined(LIBC_TARGET_HAS_FMA)
+
 // FMA instructions are available.
 #include "FMA.h"
 
+namespace __llvm_libc {
+namespace fputil {
+
 template <> inline float multiply_add<float>(float x, float y, float z) {
   return fma(x, y, z);
 }
@@ -33,9 +40,10 @@ template <> inline float multiply_add<float>(float x, float y, float z) {
 template <> inline double multiply_add<double>(double x, double y, double z) {
   return fma(x, y, z);
 }
-#endif // LIBC_TARGET_HAS_FMA
 
 } // namespace fputil
 } // namespace __llvm_libc
 
+#endif // LIBC_TARGET_HAS_FMA
+
 #endif // LLVM_LIBC_SRC_SUPPORT_FPUTIL_MULTIPLY_ADD_H


        


More information about the libc-commits mailing list