xref: /aosp_15_r20/external/llvm-libc/src/math/generic/exp_utils.h (revision 71db0c75aadcf003ffe3238005f61d7618a3fead)
1 //===-- Collection of utils for exp and friends -----------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_LIBC_SRC_MATH_GENERIC_EXP_UTILS_H
10 #define LLVM_LIBC_SRC_MATH_GENERIC_EXP_UTILS_H
11 
12 #include "src/__support/macros/config.h"
13 #include <stdint.h>
14 
15 #define EXP2F_TABLE_BITS 5
16 #define EXP2F_POLY_ORDER 3
17 #define N (1 << EXP2F_TABLE_BITS)
18 
19 namespace LIBC_NAMESPACE_DECL {
20 
21 struct Exp2fDataTable {
22   uint64_t tab[1 << EXP2F_TABLE_BITS];
23   double shift_scaled;
24   double poly[EXP2F_POLY_ORDER];
25   double shift;
26   double invln2_scaled;
27   double poly_scaled[EXP2F_POLY_ORDER];
28 };
29 
30 extern const Exp2fDataTable exp2f_data;
31 
32 } // namespace LIBC_NAMESPACE_DECL
33 
34 #endif // LLVM_LIBC_SRC_MATH_GENERIC_EXP_UTILS_H
35