1 /* Generated by Nim Compiler v1.6.2 */
2 #define NIM_INTBITS 64
3 #define NIM_EmulateOverflowChecks
4
5 #include "nimbase.h"
6 #include <math.h>
7 #undef LANGUAGE_C
8 #undef MIPSEB
9 #undef MIPSEL
10 #undef PPC
11 #undef R3000
12 #undef R4000
13 #undef i386
14 #undef linux
15 #undef mips
16 #undef near
17 #undef far
18 #undef powerpc
19 #undef unix
20 #define nimfr_(x, y)
21 #define nimln_(x, y)
22 typedef NU8 tyEnum_FloatClass__pPga1yW9b8J9cwNnm9b1aPRnA;
23 static N_INLINE(NF, abs__system_3474)(NF x);
N_NIMCALL(NI,nextPowerOfTwo__pureZmath_176)24 N_LIB_PRIVATE N_NIMCALL(NI, nextPowerOfTwo__pureZmath_176)(NI x) {
25 NI result;
26 result = (NI)0;
27 result = (NI)(x - ((NI) 1));
28 result = (NI)(result | (NI)((NI64)(result) >> (NU64)(((NI) 32))));
29 result = (NI)(result | (NI)((NI64)(result) >> (NU64)(((NI) 16))));
30 result = (NI)(result | (NI)((NI64)(result) >> (NU64)(((NI) 8))));
31 result = (NI)(result | (NI)((NI64)(result) >> (NU64)(((NI) 4))));
32 result = (NI)(result | (NI)((NI64)(result) >> (NU64)(((NI) 2))));
33 result = (NI)(result | (NI)((NI64)(result) >> (NU64)(((NI) 1))));
34 result += (NI)(((NI) 1) + (x <= ((NI) 0)));
35 return result;
36 }
N_INLINE(NF,abs__system_3474)37 static N_INLINE(NF, abs__system_3474)(NF x) {
38 NF result;
39 result = (NF)0;
40 result = fabs(x);
41 return result;
42 }
N_NIMCALL(tyEnum_FloatClass__pPga1yW9b8J9cwNnm9b1aPRnA,classify__pureZmath_147)43 N_LIB_PRIVATE N_NIMCALL(tyEnum_FloatClass__pPga1yW9b8J9cwNnm9b1aPRnA, classify__pureZmath_147)(NF x) {
44 tyEnum_FloatClass__pPga1yW9b8J9cwNnm9b1aPRnA result;
45 { result = (tyEnum_FloatClass__pPga1yW9b8J9cwNnm9b1aPRnA)0;
46 {
47 if (!(x == 0.0)) goto LA3_;
48 {
49 if (!(((NF)(1.0) / (NF)(x)) == INF)) goto LA7_;
50 result = ((tyEnum_FloatClass__pPga1yW9b8J9cwNnm9b1aPRnA) 2);
51 goto BeforeRet_;
52 }
53 goto LA5_;
54 LA7_: ;
55 {
56 result = ((tyEnum_FloatClass__pPga1yW9b8J9cwNnm9b1aPRnA) 3);
57 goto BeforeRet_;
58 }
59 LA5_: ;
60 }
61 LA3_: ;
62 {
63 if (!(((NF)(x) * (NF)(0.5)) == x)) goto LA12_;
64 {
65 if (!(0.0 < x)) goto LA16_;
66 result = ((tyEnum_FloatClass__pPga1yW9b8J9cwNnm9b1aPRnA) 5);
67 goto BeforeRet_;
68 }
69 goto LA14_;
70 LA16_: ;
71 {
72 result = ((tyEnum_FloatClass__pPga1yW9b8J9cwNnm9b1aPRnA) 6);
73 goto BeforeRet_;
74 }
75 LA14_: ;
76 }
77 LA12_: ;
78 {
79 if (!!((x == x))) goto LA21_;
80 result = ((tyEnum_FloatClass__pPga1yW9b8J9cwNnm9b1aPRnA) 4);
81 goto BeforeRet_;
82 }
83 LA21_: ;
84 {
85 NF T25_;
86 T25_ = (NF)0;
87 T25_ = abs__system_3474(x);
88 if (!(T25_ < 2.225073858507201e-308)) goto LA26_;
89 result = ((tyEnum_FloatClass__pPga1yW9b8J9cwNnm9b1aPRnA) 1);
90 goto BeforeRet_;
91 }
92 LA26_: ;
93 result = ((tyEnum_FloatClass__pPga1yW9b8J9cwNnm9b1aPRnA) 0);
94 goto BeforeRet_;
95 }BeforeRet_: ;
96 return result;
97 }
N_NIMCALL(NIM_BOOL,isPowerOfTwo__pureZmath_173)98 N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, isPowerOfTwo__pureZmath_173)(NI x) {
99 NIM_BOOL result;
100 NIM_BOOL T1_;
101 { result = (NIM_BOOL)0;
102 T1_ = (NIM_BOOL)0;
103 T1_ = (((NI) 0) < x);
104 if (!(T1_)) goto LA2_;
105 T1_ = ((NI)(x & (NI)(x - ((NI) 1))) == ((NI) 0));
106 LA2_: ;
107 result = T1_;
108 goto BeforeRet_;
109 }BeforeRet_: ;
110 return result;
111 }
112