summaryrefslogtreecommitdiff
path: root/src/math/generic/exp_utils.h
blob: 49d9a8192d344acd145c826ea4605b941a70fd1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//===-- Collection of utils for exp and friends -----------------*- C++ -*-===//
//
// 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_SRC_MATH_EXP_UTILS_H
#define LLVM_LIBC_SRC_MATH_EXP_UTILS_H

#include <stdint.h>

#define EXP2F_TABLE_BITS 5
#define EXP2F_POLY_ORDER 3
#define N (1 << EXP2F_TABLE_BITS)

namespace LIBC_NAMESPACE {

struct Exp2fDataTable {
  uint64_t tab[1 << EXP2F_TABLE_BITS];
  double shift_scaled;
  double poly[EXP2F_POLY_ORDER];
  double shift;
  double invln2_scaled;
  double poly_scaled[EXP2F_POLY_ORDER];
};

extern const Exp2fDataTable exp2f_data;

} // namespace LIBC_NAMESPACE

#endif // LLVM_LIBC_SRC_MATH_EXP_UTILS_H