[libc-commits] [libc] [libc][stdfix] Generate stdfix.h header with fixed point precision macros according to N1169 standard, and add fixed point type support detection. (PR #81255)

via libc-commits libc-commits at lists.llvm.org
Fri Feb 9 11:08:36 PST 2024


================
@@ -0,0 +1,352 @@
+//===-- Definitions from stdfix.h -----------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef __LLVM_LIBC_MACROS_STDFIX_MACROS_H
+#define __LLVM_LIBC_MACROS_STDFIX_MACROS_H
+
+#ifdef __clang__
+#if (!defined(__cplusplus) || (__clang_major__ >= 18))
+// _Fract and _Accum types are avaiable
+#define LIBC_COMPILER_HAS_FIXED_POINT
+#endif // __cplusplus
+#endif // __clang__
+
+#ifdef LIBC_COMPILER_HAS_FIXED_POINT
+
+#define fract _Fract
+#define accum _Accum
----------------
lntue wrote:

Done.

https://github.com/llvm/llvm-project/pull/81255


More information about the libc-commits mailing list