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