1 /* Generated by Nim Compiler v1.6.2 */
2 #define NIM_INTBITS 64
3
4 #include "nimbase.h"
5 #undef LANGUAGE_C
6 #undef MIPSEB
7 #undef MIPSEL
8 #undef PPC
9 #undef R3000
10 #undef R4000
11 #undef i386
12 #undef linux
13 #undef mips
14 #undef near
15 #undef far
16 #undef powerpc
17 #undef unix
18 #define nimfr_(x, y)
19 #define nimln_(x, y)
20 typedef struct NimStringDesc NimStringDesc;
21 typedef struct TGenericSeq TGenericSeq;
22 struct TGenericSeq {
23 NI len;
24 NI reserved;
25 };
26 struct NimStringDesc {
27 TGenericSeq Sup;
28 NIM_CHAR data[SEQ_DECL_SIZE];
29 };
30 N_LIB_PRIVATE N_NIMCALL(NI, murmurHash__pureZhashes_192)(NU8* x, NI xLen_0);
31 static N_INLINE(NU32, rotl32__pureZhashes_180)(NU32 x, NI r);
32 static N_INLINE(NI, emarkamp___pureZhashes_3)(NI h, NI val);
33 static N_INLINE(NI, emarkdollar___pureZhashes_18)(NI h);
N_INLINE(NU32,rotl32__pureZhashes_180)34 static N_INLINE(NU32, rotl32__pureZhashes_180)(NU32 x, NI r) {
35 NU32 result;
36 result = (NU32)0;
37 result = (NU32)((NU32)((NU64)(x) << (NU64)(r)) | (NU32)((NU32)(x) >> (NU64)((NI)(((NI) 32) - r))));
38 return result;
39 }
N_NIMCALL(NI,murmurHash__pureZhashes_192)40 N_LIB_PRIVATE N_NIMCALL(NI, murmurHash__pureZhashes_192)(NU8* x, NI xLen_0) {
41 NI result;
42 NI size;
43 NI stepSize;
44 NI n;
45 NU32 h1;
46 NI i;
47 NU32 k1_2;
48 NI rem;
49 { result = (NI)0;
50 size = xLen_0;
51 stepSize = ((NI) 4);
52 n = (NI)(size / stepSize);
53 h1 = (NU32)0;
54 i = ((NI) 0);
55 {
56 while (1) {
57 NU32 k1;
58 if (!(i < (NI)(n * stepSize))) goto LA2;
59 k1 = (NU32)0;
60 k1 = (*((NU32*) ((&x[i]))));
61 i += stepSize;
62 k1 = (NU32)((NU32)(k1) * (NU32)(((NU32) IL64(3432918353))));
63 k1 = rotl32__pureZhashes_180(k1, ((NI) 15));
64 k1 = (NU32)((NU32)(k1) * (NU32)(((NU32) 461845907)));
65 h1 = (NU32)(h1 ^ k1);
66 h1 = rotl32__pureZhashes_180(h1, ((NI) 13));
67 h1 = (NU32)((NU32)((NU32)((NU32)(h1) * (NU32)(((NU32) 5)))) + (NU32)(((NU32) IL64(3864292196))));
68 } LA2: ;
69 }
70 k1_2 = (NU32)0;
71 rem = (NI)(size % stepSize);
72 {
73 while (1) {
74 if (!(((NI) 0) < rem)) goto LA4;
75 rem -= ((NI) 1);
76 k1_2 = (NU32)((NU32)((NU64)(k1_2) << (NU64)(((NI) 8))) | ((NU32) (x[(NI)(i + rem)])));
77 } LA4: ;
78 }
79 k1_2 = (NU32)((NU32)(k1_2) * (NU32)(((NU32) IL64(3432918353))));
80 k1_2 = rotl32__pureZhashes_180(k1_2, ((NI) 15));
81 k1_2 = (NU32)((NU32)(k1_2) * (NU32)(((NU32) 461845907)));
82 h1 = (NU32)(h1 ^ k1_2);
83 h1 = (NU32)(h1 ^ ((NU32) (size)));
84 h1 = (NU32)(h1 ^ (NU32)((NU32)(h1) >> (NU64)(((NI) 16))));
85 h1 = (NU32)((NU32)(h1) * (NU32)(((NU32) IL64(2246822507))));
86 h1 = (NU32)(h1 ^ (NU32)((NU32)(h1) >> (NU64)(((NI) 13))));
87 h1 = (NU32)((NU32)(h1) * (NU32)(((NU32) IL64(3266489909))));
88 h1 = (NU32)(h1 ^ (NU32)((NU32)(h1) >> (NU64)(((NI) 16))));
89 result = ((NI) (h1));
90 goto BeforeRet_;
91 }BeforeRet_: ;
92 return result;
93 }
N_NIMCALL(NI,hash__pureZhashes_279)94 N_LIB_PRIVATE N_NIMCALL(NI, hash__pureZhashes_279)(NimStringDesc* x) {
95 NI result;
96 result = (NI)0;
97 result = murmurHash__pureZhashes_192((NU8*)x->data+(((NI) 0)), (((x ? x->Sup.len : 0)-1))-(((NI) 0))+1);
98 return result;
99 }
N_INLINE(NI,emarkamp___pureZhashes_3)100 static N_INLINE(NI, emarkamp___pureZhashes_3)(NI h, NI val) {
101 NI result;
102 NU h_2;
103 NU val_2;
104 NU res;
105 result = (NI)0;
106 h_2 = ((NU) (h));
107 val_2 = ((NU) (val));
108 res = (NU)((NU64)(h_2) + (NU64)(val_2));
109 res = (NU)((NU64)(res) + (NU64)((NU)((NU64)(res) << (NU64)(((NI) 10)))));
110 res = (NU)(res ^ (NU)((NU64)(res) >> (NU64)(((NI) 6))));
111 result = ((NI) (res));
112 return result;
113 }
N_INLINE(NI,emarkdollar___pureZhashes_18)114 static N_INLINE(NI, emarkdollar___pureZhashes_18)(NI h) {
115 NI result;
116 NU h_2;
117 NU res;
118 result = (NI)0;
119 h_2 = ((NU) (h));
120 res = (NU)((NU64)(h_2) + (NU64)((NU)((NU64)(h_2) << (NU64)(((NI) 3)))));
121 res = (NU)(res ^ (NU)((NU64)(res) >> (NU64)(((NI) 11))));
122 res = (NU)((NU64)(res) + (NU64)((NU)((NU64)(res) << (NU64)(((NI) 15)))));
123 result = ((NI) (res));
124 return result;
125 }
N_NIMCALL(NI,hashIgnoreCase__pureZhashes_353)126 N_LIB_PRIVATE N_NIMCALL(NI, hashIgnoreCase__pureZhashes_353)(NimStringDesc* x) {
127 NI result;
128 NI h;
129 result = (NI)0;
130 h = ((NI) 0);
131 {
132 NI i;
133 NI colontmp_;
134 NI res;
135 i = (NI)0;
136 colontmp_ = (NI)0;
137 colontmp_ = (NI)((x ? x->Sup.len : 0) - ((NI) 1));
138 res = ((NI) 0);
139 {
140 while (1) {
141 NIM_CHAR c;
142 if (!(res <= colontmp_)) goto LA3;
143 i = res;
144 c = x->data[i];
145 {
146 if (!(((NU8)(c)) >= ((NU8)(65)) && ((NU8)(c)) <= ((NU8)(90)))) goto LA6_;
147 c = ((NIM_CHAR) (((NI) ((NI)(((NU8)(c)) + ((NI) 32))))));
148 }
149 LA6_: ;
150 h = emarkamp___pureZhashes_3(h, ((NU8)(c)));
151 res += ((NI) 1);
152 } LA3: ;
153 }
154 }
155 result = emarkdollar___pureZhashes_18(h);
156 return result;
157 }
N_NIMCALL(NI,hashIgnoreStyle__pureZhashes_290)158 N_LIB_PRIVATE N_NIMCALL(NI, hashIgnoreStyle__pureZhashes_290)(NimStringDesc* x) {
159 NI result;
160 NI h;
161 NI i;
162 NI xLen;
163 result = (NI)0;
164 h = ((NI) 0);
165 i = ((NI) 0);
166 xLen = (x ? x->Sup.len : 0);
167 {
168 while (1) {
169 NIM_CHAR c;
170 if (!(i < xLen)) goto LA2;
171 c = x->data[i];
172 {
173 if (!((NU8)(c) == (NU8)(95))) goto LA5_;
174 i += ((NI) 1);
175 }
176 goto LA3_;
177 LA5_: ;
178 {
179 {
180 if (!(((NU8)(c)) >= ((NU8)(65)) && ((NU8)(c)) <= ((NU8)(90)))) goto LA10_;
181 c = ((NIM_CHAR) (((NI) ((NI)(((NU8)(c)) + ((NI) 32))))));
182 }
183 LA10_: ;
184 h = emarkamp___pureZhashes_3(h, ((NU8)(c)));
185 i += ((NI) 1);
186 }
187 LA3_: ;
188 } LA2: ;
189 }
190 result = emarkdollar___pureZhashes_18(h);
191 return result;
192 }
N_NIMCALL(NI,hash__pureZhashes_285)193 N_LIB_PRIVATE N_NIMCALL(NI, hash__pureZhashes_285)(NimStringDesc* sBuf, NI sPos, NI ePos) {
194 NI result;
195 result = (NI)0;
196 result = murmurHash__pureZhashes_192((NU8*)sBuf->data+(sPos), (ePos)-(sPos)+1);
197 return result;
198 }
199