Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
fp128.h
Go to the documentation of this file.
1#ifndef __compiler_rt_fp_128_h__
2#define __compiler_rt_fp_128_h__
3
4#include <limits.h>
5#include <stdint.h>
7
8#define REP_C (__uint128_t)
9#define significandBits 112
10#define typeWidth (sizeof(__int128)*CHAR_BIT)
11#define exponentBits (typeWidth - significandBits - 1)
12#define maxExponent ((1 << exponentBits) - 1)
13#define exponentBias (maxExponent >> 1)
14
15#define implicitBit (REP_C(1) << significandBits)
16#define significandMask (implicitBit - 1U)
17#define signBit (REP_C(1) << (significandBits + exponentBits))
18#define absMask (signBit - 1U)
19#define exponentMask (absMask ^ significandMask)
20#define oneRep ((rep_t)exponentBias << significandBits)
21#define infRep exponentMask
22#define quietBit (implicitBit >> 1)
23#define qnanRep (exponentMask | quietBit)
24
25static __inline __int128 toRep(float128_t x) {
26 const union { float128_t f; __int128 i; } rep = {.f = x};
27 return rep.i;
28}
29
30#endif //__compiler_rt_fp_h__
void rep()