File: f64consts.h

package info (click to toggle)
intel-graphics-compiler2 2.18.5-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 107,080 kB
  • sloc: cpp: 807,289; lisp: 287,855; ansic: 16,414; python: 4,004; yacc: 2,588; lex: 1,666; pascal: 313; sh: 186; makefile: 35
file content (33 lines) | stat: -rw-r--r-- 1,077 bytes parent folder | download | duplicates (2)
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
/*========================== begin_copyright_notice ============================

Copyright (C) 2024 Intel Corporation

SPDX-License-Identifier: MIT

============================= end_copyright_notice ===========================*/

#ifndef F64CONSTS_H
#define F64CONSTS_H

// We have to use 32-bit integers when it's possible
constexpr unsigned exp_shift = 52 - 32;
constexpr unsigned exp_mask = 0x7ff;
constexpr unsigned exp_bias = 0x3ff;
constexpr unsigned exp_32bitmask = exp_mask << exp_shift;
constexpr unsigned exp_invmask = ~(exp_32bitmask);
constexpr unsigned exp_32threshold_shift = 0x432;
constexpr unsigned mantissa_32loss = -2;
constexpr unsigned nan_hi = 0x7ff80000;
constexpr unsigned inf_hi = 0x7ff00000;
constexpr unsigned sign_32bit = 1 << (63 - 32);
constexpr unsigned min_sign_exp = 1 << exp_shift;

// Double consts
constexpr double twoPow1023 = 0x1p+1023;
constexpr double twoPow1022 = 0x1p+1022;
constexpr double twoPow64 = 0x1p+64;
constexpr double twoPow32 = 0x1p+32;
constexpr double twoPowm64 = 0x1p-64;
constexpr double roundInt = 0x1.8p+52;

#endif