File: %40m..%40slib%40spure%40shashes.nim.c

package info (click to toggle)
nim 1.6.14-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,181,140 kB
  • sloc: sh: 20,999; ansic: 1,722; makefile: 958; python: 461; sql: 298; asm: 141; xml: 13
file content (296 lines) | stat: -rw-r--r-- 8,389 bytes parent folder | download | duplicates (6)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
/* Generated by Nim Compiler v1.6.14 */
#define NIM_INTBITS 64
#define NIM_EmulateOverflowChecks

#include "nimbase.h"
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix
#define nimfr_(x, y)
#define nimln_(x, y)
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ;
typedef struct tyTuple__47w2DboNEPf69aPgubZdd7Q tyTuple__47w2DboNEPf69aPgubZdd7Q;
typedef struct tyTuple__Q066krdfdsSnR5DaFMOk9bQ tyTuple__Q066krdfdsSnR5DaFMOk9bQ;
typedef struct tyObject_TNode__uh9cWvEa5Ty85PXOtuP5emw tyObject_TNode__uh9cWvEa5Ty85PXOtuP5emw;
struct TGenericSeq {
NI len;
NI reserved;
};
struct NimStringDesc {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ {
NI Field0;
NI Field1;
};
struct tyTuple__47w2DboNEPf69aPgubZdd7Q {
NI Field0;
NI Field1;
NI Field2;
};
struct tyTuple__Q066krdfdsSnR5DaFMOk9bQ {
tyObject_TNode__uh9cWvEa5Ty85PXOtuP5emw* Field0;
tyObject_TNode__uh9cWvEa5Ty85PXOtuP5emw* Field1;
};
N_LIB_PRIVATE N_NIMCALL(NI, murmurHash__pureZhashes_192)(NU8* x, NI xLen_0);
static N_INLINE(NU32, rotl32__pureZhashes_180)(NU32 x, NI r);
static N_INLINE(NI, emarkamp___pureZhashes_3)(NI h, NI val);
static N_INLINE(NI, emarkdollar___pureZhashes_18)(NI h);
static N_INLINE(NI, hash__pureZhashes_128)(NI x);
static N_INLINE(NI, hashWangYi1__pureZhashes_136)(NU64 x);
static N_INLINE(NU64, hiXorLo__pureZhashes_79)(NU64 a, NU64 b);
N_LIB_PRIVATE N_NIMCALL(NI, hash__injectdestructors_118)(tyObject_TNode__uh9cWvEa5Ty85PXOtuP5emw* n);
static N_INLINE(NU32, rotl32__pureZhashes_180)(NU32 x, NI r) {
	NU32 result;
	result = (NU32)0;
	result = (NU32)((NU32)((NU64)(x) << (NU64)(r)) | (NU32)((NU32)(x) >> (NU64)((NI)(((NI) 32) - r))));
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, murmurHash__pureZhashes_192)(NU8* x, NI xLen_0) {
	NI result;
	NI size;
	NI stepSize;
	NI n;
	NU32 h1;
	NI i;
	NU32 k1_2;
	NI rem;
{	result = (NI)0;
	size = xLen_0;
	stepSize = ((NI) 4);
	n = (NI)(size / stepSize);
	h1 = (NU32)0;
	i = ((NI) 0);
	{
		while (1) {
			NU32 k1;
			if (!(i < (NI)(n * stepSize))) goto LA2;
			k1 = (NU32)0;
			k1 = (*((NU32*) ((&x[i]))));
			i += stepSize;
			k1 = (NU32)((NU32)(k1) * (NU32)(((NU32) IL64(3432918353))));
			k1 = rotl32__pureZhashes_180(k1, ((NI) 15));
			k1 = (NU32)((NU32)(k1) * (NU32)(((NU32) 461845907)));
			h1 = (NU32)(h1 ^ k1);
			h1 = rotl32__pureZhashes_180(h1, ((NI) 13));
			h1 = (NU32)((NU32)((NU32)((NU32)(h1) * (NU32)(((NU32) 5)))) + (NU32)(((NU32) IL64(3864292196))));
		} LA2: ;
	}
	k1_2 = (NU32)0;
	rem = (NI)(size % stepSize);
	{
		while (1) {
			if (!(((NI) 0) < rem)) goto LA4;
			rem -= ((NI) 1);
			k1_2 = (NU32)((NU32)((NU64)(k1_2) << (NU64)(((NI) 8))) | ((NU32) (x[(NI)(i + rem)])));
		} LA4: ;
	}
	k1_2 = (NU32)((NU32)(k1_2) * (NU32)(((NU32) IL64(3432918353))));
	k1_2 = rotl32__pureZhashes_180(k1_2, ((NI) 15));
	k1_2 = (NU32)((NU32)(k1_2) * (NU32)(((NU32) 461845907)));
	h1 = (NU32)(h1 ^ k1_2);
	h1 = (NU32)(h1 ^ ((NU32) (size)));
	h1 = (NU32)(h1 ^ (NU32)((NU32)(h1) >> (NU64)(((NI) 16))));
	h1 = (NU32)((NU32)(h1) * (NU32)(((NU32) IL64(2246822507))));
	h1 = (NU32)(h1 ^ (NU32)((NU32)(h1) >> (NU64)(((NI) 13))));
	h1 = (NU32)((NU32)(h1) * (NU32)(((NU32) IL64(3266489909))));
	h1 = (NU32)(h1 ^ (NU32)((NU32)(h1) >> (NU64)(((NI) 16))));
	result = ((NI) (h1));
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, hash__pureZhashes_279)(NimStringDesc* x) {
	NI result;
	result = (NI)0;
	result = murmurHash__pureZhashes_192(((x) ? ((NU8*)x->data+(((NI) 0))) : NIM_NIL), (((x ? x->Sup.len : 0)-1))-(((NI) 0))+1);
	return result;
}
static N_INLINE(NI, emarkamp___pureZhashes_3)(NI h, NI val) {
	NI result;
	NU h_2;
	NU val_2;
	NU res;
	result = (NI)0;
	h_2 = ((NU) (h));
	val_2 = ((NU) (val));
	res = (NU)((NU64)(h_2) + (NU64)(val_2));
	res = (NU)((NU64)(res) + (NU64)((NU)((NU64)(res) << (NU64)(((NI) 10)))));
	res = (NU)(res ^ (NU)((NU64)(res) >> (NU64)(((NI) 6))));
	result = ((NI) (res));
	return result;
}
static N_INLINE(NI, emarkdollar___pureZhashes_18)(NI h) {
	NI result;
	NU h_2;
	NU res;
	result = (NI)0;
	h_2 = ((NU) (h));
	res = (NU)((NU64)(h_2) + (NU64)((NU)((NU64)(h_2) << (NU64)(((NI) 3)))));
	res = (NU)(res ^ (NU)((NU64)(res) >> (NU64)(((NI) 11))));
	res = (NU)((NU64)(res) + (NU64)((NU)((NU64)(res) << (NU64)(((NI) 15)))));
	result = ((NI) (res));
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, hashIgnoreCase__pureZhashes_353)(NimStringDesc* x) {
	NI result;
	NI h;
	result = (NI)0;
	h = ((NI) 0);
	{
		NI i;
		NI colontmp_;
		NI res;
		i = (NI)0;
		colontmp_ = (NI)0;
		colontmp_ = (NI)((x ? x->Sup.len : 0) - ((NI) 1));
		res = ((NI) 0);
		{
			while (1) {
				NIM_CHAR c;
				if (!(res <= colontmp_)) goto LA3;
				i = res;
				c = x->data[i];
				{
					if (!(((NU8)(c)) >= ((NU8)(65)) && ((NU8)(c)) <= ((NU8)(90)))) goto LA6_;
					c = ((NIM_CHAR) (((NI) ((NI)(((NU8)(c)) + ((NI) 32))))));
				}
				LA6_: ;
				h = emarkamp___pureZhashes_3(h, ((NU8)(c)));
				res += ((NI) 1);
			} LA3: ;
		}
	}
	result = emarkdollar___pureZhashes_18(h);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, hashIgnoreStyle__pureZhashes_290)(NimStringDesc* x) {
	NI result;
	NI h;
	NI i;
	NI xLen;
	result = (NI)0;
	h = ((NI) 0);
	i = ((NI) 0);
	xLen = (x ? x->Sup.len : 0);
	{
		while (1) {
			NIM_CHAR c;
			if (!(i < xLen)) goto LA2;
			c = x->data[i];
			{
				if (!((NU8)(c) == (NU8)(95))) goto LA5_;
				i += ((NI) 1);
			}
			goto LA3_;
			LA5_: ;
			{
				{
					if (!(((NU8)(c)) >= ((NU8)(65)) && ((NU8)(c)) <= ((NU8)(90)))) goto LA10_;
					c = ((NIM_CHAR) (((NI) ((NI)(((NU8)(c)) + ((NI) 32))))));
				}
				LA10_: ;
				h = emarkamp___pureZhashes_3(h, ((NU8)(c)));
				i += ((NI) 1);
			}
			LA3_: ;
		} LA2: ;
	}
	result = emarkdollar___pureZhashes_18(h);
	return result;
}
static N_INLINE(NU64, hiXorLo__pureZhashes_79)(NU64 a, NU64 b) {
	NU64 result;
	result = (NU64)0;
	__uint128_t r = a; r *= b; result = (r >> 64) ^ r;
	return result;
}
static N_INLINE(NI, hashWangYi1__pureZhashes_136)(NU64 x) {
	NI result;
	NU64 T1_;
	NU64 T2_;
	result = (NI)0;
	T1_ = (NU64)0;
	T1_ = hiXorLo__pureZhashes_79(11562461410679940143ULL, (NU64)(x ^ 16646288086500911323ULL));
	T2_ = (NU64)0;
	T2_ = hiXorLo__pureZhashes_79(T1_, 16952864883938283885ULL);
	result = ((NI) (T2_));
	return result;
}
static N_INLINE(NI, hash__pureZhashes_128)(NI x) {
	NI result;
	result = (NI)0;
	result = hashWangYi1__pureZhashes_136(((NU64) (x)));
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, hash__sigmatch_5808)(tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ x) {
	NI result;
	NI T1_;
	NI T2_;
	result = (NI)0;
	T1_ = (NI)0;
	T1_ = hash__pureZhashes_128(x.Field0);
	result = emarkamp___pureZhashes_3(result, T1_);
	T2_ = (NI)0;
	T2_ = hash__pureZhashes_128(x.Field1);
	result = emarkamp___pureZhashes_3(result, T2_);
	result = emarkdollar___pureZhashes_18(result);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, hash__pureZhashes_285)(NimStringDesc* sBuf, NI sPos, NI ePos) {
	NI result;
	result = (NI)0;
	result = murmurHash__pureZhashes_192(((sBuf) ? ((NU8*)sBuf->data+(sPos)) : NIM_NIL), (ePos)-(sPos)+1);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, hash__vm_13686)(NU8* aBuf, NI aBufLen_0, NI sPos, NI ePos) {
	NI result;
	result = (NI)0;
	result = murmurHash__pureZhashes_192((NU8*)(aBuf)+(sPos), (ePos)-(sPos)+1);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, hash__lineinfos_236)(tyTuple__47w2DboNEPf69aPgubZdd7Q x) {
	NI result;
	NI T1_;
	NI T2_;
	NI T3_;
	result = (NI)0;
	T1_ = (NI)0;
	T1_ = hash__pureZhashes_128(x.Field0);
	result = emarkamp___pureZhashes_3(result, T1_);
	T2_ = (NI)0;
	T2_ = hash__pureZhashes_128(x.Field1);
	result = emarkamp___pureZhashes_3(result, T2_);
	T3_ = (NI)0;
	T3_ = hash__pureZhashes_128(x.Field2);
	result = emarkamp___pureZhashes_3(result, T3_);
	result = emarkdollar___pureZhashes_18(result);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, hash__injectdestructors_188)(tyTuple__Q066krdfdsSnR5DaFMOk9bQ x) {
	NI result;
	NI T1_;
	NI T2_;
	result = (NI)0;
	T1_ = (NI)0;
	T1_ = hash__injectdestructors_118(x.Field0);
	result = emarkamp___pureZhashes_3(result, T1_);
	T2_ = (NI)0;
	T2_ = hash__injectdestructors_118(x.Field1);
	result = emarkamp___pureZhashes_3(result, T2_);
	result = emarkdollar___pureZhashes_18(result);
	return result;
}