[libc-commits] [libc] [libc] Adding FP_INT_* macro constants if missing in overlay mode. (PR #87880)

via libc-commits libc-commits at lists.llvm.org
Sat Apr 6 08:55:41 PDT 2024


https://github.com/lntue created https://github.com/llvm/llvm-project/pull/87880

None

>From d8455cee7b48ce693775be50dd2b324dbf7cd12c Mon Sep 17 00:00:00 2001
From: Tue Ly <lntue at google.com>
Date: Sat, 6 Apr 2024 11:52:24 -0400
Subject: [PATCH] [libc] Adding FP_INT_* macro constants if missing in overlay
 mode.

---
 libc/hdr/math_macros.h | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/libc/hdr/math_macros.h b/libc/hdr/math_macros.h
index 864afd0e50e356..d13c5ff7647ad2 100644
--- a/libc/hdr/math_macros.h
+++ b/libc/hdr/math_macros.h
@@ -17,6 +17,27 @@
 
 #include <math.h>
 
+// Some older math.h header does not have FP_INT_* constants yet.
+#ifndef FP_INT_UPWARD
+#define FP_INT_UPWARD 0
+#endif // FP_INT_UPWARD
+
+#ifndef FP_INT_DOWNWARD
+#define FP_INT_DOWNWARD 1
+#endif // FP_INT_DOWNWARD
+
+#ifndef FP_INT_TOWARDZERO
+#define FP_INT_TOWARDZERO 2
+#endif // FP_INT_TOWARDZERO
+
+#ifndef FP_INT_TONEARESTFROMZERO
+#define FP_INT_TONEARESTFROMZERO 3
+#endif // FP_INT_TONEARESTFROMZERO
+
+#ifndef FP_INT_TONEAREST
+#define FP_INT_TONEAREST 4
+#endif // FP_INT_TONEAREST
+
 #endif // LLVM_LIBC_FULL_BUILD
 
 #endif // LLVM_LIBC_HDR_MATH_MACROS_H



More information about the libc-commits mailing list