1 | // DuckDB |
2 | // |
3 | // duckdb/common/fast_mem.hpp |
4 | // |
5 | // |
6 | //===----------------------------------------------------------------------===// |
7 | |
8 | #pragma once |
9 | |
10 | #include "duckdb/common/common.hpp" |
11 | #include "duckdb/common/types.hpp" |
12 | |
13 | template <size_t SIZE> |
14 | static inline void MemcpyFixed(void *dest, const void *src) { |
15 | memcpy(dest: dest, src: src, n: SIZE); |
16 | } |
17 | |
18 | template <size_t SIZE> |
19 | static inline int MemcmpFixed(const void *str1, const void *str2) { |
20 | return memcmp(s1: str1, s2: str2, n: SIZE); |
21 | } |
22 | |
23 | template <size_t SIZE> |
24 | static inline void MemsetFixed(void *ptr, int value) { |
25 | memset(s: ptr, c: value, n: SIZE); |
26 | } |
27 | |
28 | namespace duckdb { |
29 | |
30 | //! This templated memcpy is significantly faster than std::memcpy, |
31 | //! but only when you are calling memcpy with a const size in a loop. |
32 | //! For instance `while (<cond>) { memcpy(<dest>, <src>, const_size); ... }` |
33 | static inline void FastMemcpy(void *dest, const void *src, const size_t size) { |
34 | // LCOV_EXCL_START |
35 | switch (size) { |
36 | case 0: |
37 | return; |
38 | case 1: |
39 | return MemcpyFixed<1>(dest, src); |
40 | case 2: |
41 | return MemcpyFixed<2>(dest, src); |
42 | case 3: |
43 | return MemcpyFixed<3>(dest, src); |
44 | case 4: |
45 | return MemcpyFixed<4>(dest, src); |
46 | case 5: |
47 | return MemcpyFixed<5>(dest, src); |
48 | case 6: |
49 | return MemcpyFixed<6>(dest, src); |
50 | case 7: |
51 | return MemcpyFixed<7>(dest, src); |
52 | case 8: |
53 | return MemcpyFixed<8>(dest, src); |
54 | case 9: |
55 | return MemcpyFixed<9>(dest, src); |
56 | case 10: |
57 | return MemcpyFixed<10>(dest, src); |
58 | case 11: |
59 | return MemcpyFixed<11>(dest, src); |
60 | case 12: |
61 | return MemcpyFixed<12>(dest, src); |
62 | case 13: |
63 | return MemcpyFixed<13>(dest, src); |
64 | case 14: |
65 | return MemcpyFixed<14>(dest, src); |
66 | case 15: |
67 | return MemcpyFixed<15>(dest, src); |
68 | case 16: |
69 | return MemcpyFixed<16>(dest, src); |
70 | case 17: |
71 | return MemcpyFixed<17>(dest, src); |
72 | case 18: |
73 | return MemcpyFixed<18>(dest, src); |
74 | case 19: |
75 | return MemcpyFixed<19>(dest, src); |
76 | case 20: |
77 | return MemcpyFixed<20>(dest, src); |
78 | case 21: |
79 | return MemcpyFixed<21>(dest, src); |
80 | case 22: |
81 | return MemcpyFixed<22>(dest, src); |
82 | case 23: |
83 | return MemcpyFixed<23>(dest, src); |
84 | case 24: |
85 | return MemcpyFixed<24>(dest, src); |
86 | case 25: |
87 | return MemcpyFixed<25>(dest, src); |
88 | case 26: |
89 | return MemcpyFixed<26>(dest, src); |
90 | case 27: |
91 | return MemcpyFixed<27>(dest, src); |
92 | case 28: |
93 | return MemcpyFixed<28>(dest, src); |
94 | case 29: |
95 | return MemcpyFixed<29>(dest, src); |
96 | case 30: |
97 | return MemcpyFixed<30>(dest, src); |
98 | case 31: |
99 | return MemcpyFixed<31>(dest, src); |
100 | case 32: |
101 | return MemcpyFixed<32>(dest, src); |
102 | case 33: |
103 | return MemcpyFixed<33>(dest, src); |
104 | case 34: |
105 | return MemcpyFixed<34>(dest, src); |
106 | case 35: |
107 | return MemcpyFixed<35>(dest, src); |
108 | case 36: |
109 | return MemcpyFixed<36>(dest, src); |
110 | case 37: |
111 | return MemcpyFixed<37>(dest, src); |
112 | case 38: |
113 | return MemcpyFixed<38>(dest, src); |
114 | case 39: |
115 | return MemcpyFixed<39>(dest, src); |
116 | case 40: |
117 | return MemcpyFixed<40>(dest, src); |
118 | case 41: |
119 | return MemcpyFixed<41>(dest, src); |
120 | case 42: |
121 | return MemcpyFixed<42>(dest, src); |
122 | case 43: |
123 | return MemcpyFixed<43>(dest, src); |
124 | case 44: |
125 | return MemcpyFixed<44>(dest, src); |
126 | case 45: |
127 | return MemcpyFixed<45>(dest, src); |
128 | case 46: |
129 | return MemcpyFixed<46>(dest, src); |
130 | case 47: |
131 | return MemcpyFixed<47>(dest, src); |
132 | case 48: |
133 | return MemcpyFixed<48>(dest, src); |
134 | case 49: |
135 | return MemcpyFixed<49>(dest, src); |
136 | case 50: |
137 | return MemcpyFixed<50>(dest, src); |
138 | case 51: |
139 | return MemcpyFixed<51>(dest, src); |
140 | case 52: |
141 | return MemcpyFixed<52>(dest, src); |
142 | case 53: |
143 | return MemcpyFixed<53>(dest, src); |
144 | case 54: |
145 | return MemcpyFixed<54>(dest, src); |
146 | case 55: |
147 | return MemcpyFixed<55>(dest, src); |
148 | case 56: |
149 | return MemcpyFixed<56>(dest, src); |
150 | case 57: |
151 | return MemcpyFixed<57>(dest, src); |
152 | case 58: |
153 | return MemcpyFixed<58>(dest, src); |
154 | case 59: |
155 | return MemcpyFixed<59>(dest, src); |
156 | case 60: |
157 | return MemcpyFixed<60>(dest, src); |
158 | case 61: |
159 | return MemcpyFixed<61>(dest, src); |
160 | case 62: |
161 | return MemcpyFixed<62>(dest, src); |
162 | case 63: |
163 | return MemcpyFixed<63>(dest, src); |
164 | case 64: |
165 | return MemcpyFixed<64>(dest, src); |
166 | case 65: |
167 | return MemcpyFixed<65>(dest, src); |
168 | case 66: |
169 | return MemcpyFixed<66>(dest, src); |
170 | case 67: |
171 | return MemcpyFixed<67>(dest, src); |
172 | case 68: |
173 | return MemcpyFixed<68>(dest, src); |
174 | case 69: |
175 | return MemcpyFixed<69>(dest, src); |
176 | case 70: |
177 | return MemcpyFixed<70>(dest, src); |
178 | case 71: |
179 | return MemcpyFixed<71>(dest, src); |
180 | case 72: |
181 | return MemcpyFixed<72>(dest, src); |
182 | case 73: |
183 | return MemcpyFixed<73>(dest, src); |
184 | case 74: |
185 | return MemcpyFixed<74>(dest, src); |
186 | case 75: |
187 | return MemcpyFixed<75>(dest, src); |
188 | case 76: |
189 | return MemcpyFixed<76>(dest, src); |
190 | case 77: |
191 | return MemcpyFixed<77>(dest, src); |
192 | case 78: |
193 | return MemcpyFixed<78>(dest, src); |
194 | case 79: |
195 | return MemcpyFixed<79>(dest, src); |
196 | case 80: |
197 | return MemcpyFixed<80>(dest, src); |
198 | case 81: |
199 | return MemcpyFixed<81>(dest, src); |
200 | case 82: |
201 | return MemcpyFixed<82>(dest, src); |
202 | case 83: |
203 | return MemcpyFixed<83>(dest, src); |
204 | case 84: |
205 | return MemcpyFixed<84>(dest, src); |
206 | case 85: |
207 | return MemcpyFixed<85>(dest, src); |
208 | case 86: |
209 | return MemcpyFixed<86>(dest, src); |
210 | case 87: |
211 | return MemcpyFixed<87>(dest, src); |
212 | case 88: |
213 | return MemcpyFixed<88>(dest, src); |
214 | case 89: |
215 | return MemcpyFixed<89>(dest, src); |
216 | case 90: |
217 | return MemcpyFixed<90>(dest, src); |
218 | case 91: |
219 | return MemcpyFixed<91>(dest, src); |
220 | case 92: |
221 | return MemcpyFixed<92>(dest, src); |
222 | case 93: |
223 | return MemcpyFixed<93>(dest, src); |
224 | case 94: |
225 | return MemcpyFixed<94>(dest, src); |
226 | case 95: |
227 | return MemcpyFixed<95>(dest, src); |
228 | case 96: |
229 | return MemcpyFixed<96>(dest, src); |
230 | case 97: |
231 | return MemcpyFixed<97>(dest, src); |
232 | case 98: |
233 | return MemcpyFixed<98>(dest, src); |
234 | case 99: |
235 | return MemcpyFixed<99>(dest, src); |
236 | case 100: |
237 | return MemcpyFixed<100>(dest, src); |
238 | case 101: |
239 | return MemcpyFixed<101>(dest, src); |
240 | case 102: |
241 | return MemcpyFixed<102>(dest, src); |
242 | case 103: |
243 | return MemcpyFixed<103>(dest, src); |
244 | case 104: |
245 | return MemcpyFixed<104>(dest, src); |
246 | case 105: |
247 | return MemcpyFixed<105>(dest, src); |
248 | case 106: |
249 | return MemcpyFixed<106>(dest, src); |
250 | case 107: |
251 | return MemcpyFixed<107>(dest, src); |
252 | case 108: |
253 | return MemcpyFixed<108>(dest, src); |
254 | case 109: |
255 | return MemcpyFixed<109>(dest, src); |
256 | case 110: |
257 | return MemcpyFixed<110>(dest, src); |
258 | case 111: |
259 | return MemcpyFixed<111>(dest, src); |
260 | case 112: |
261 | return MemcpyFixed<112>(dest, src); |
262 | case 113: |
263 | return MemcpyFixed<113>(dest, src); |
264 | case 114: |
265 | return MemcpyFixed<114>(dest, src); |
266 | case 115: |
267 | return MemcpyFixed<115>(dest, src); |
268 | case 116: |
269 | return MemcpyFixed<116>(dest, src); |
270 | case 117: |
271 | return MemcpyFixed<117>(dest, src); |
272 | case 118: |
273 | return MemcpyFixed<118>(dest, src); |
274 | case 119: |
275 | return MemcpyFixed<119>(dest, src); |
276 | case 120: |
277 | return MemcpyFixed<120>(dest, src); |
278 | case 121: |
279 | return MemcpyFixed<121>(dest, src); |
280 | case 122: |
281 | return MemcpyFixed<122>(dest, src); |
282 | case 123: |
283 | return MemcpyFixed<123>(dest, src); |
284 | case 124: |
285 | return MemcpyFixed<124>(dest, src); |
286 | case 125: |
287 | return MemcpyFixed<125>(dest, src); |
288 | case 126: |
289 | return MemcpyFixed<126>(dest, src); |
290 | case 127: |
291 | return MemcpyFixed<127>(dest, src); |
292 | case 128: |
293 | return MemcpyFixed<128>(dest, src); |
294 | case 129: |
295 | return MemcpyFixed<129>(dest, src); |
296 | case 130: |
297 | return MemcpyFixed<130>(dest, src); |
298 | case 131: |
299 | return MemcpyFixed<131>(dest, src); |
300 | case 132: |
301 | return MemcpyFixed<132>(dest, src); |
302 | case 133: |
303 | return MemcpyFixed<133>(dest, src); |
304 | case 134: |
305 | return MemcpyFixed<134>(dest, src); |
306 | case 135: |
307 | return MemcpyFixed<135>(dest, src); |
308 | case 136: |
309 | return MemcpyFixed<136>(dest, src); |
310 | case 137: |
311 | return MemcpyFixed<137>(dest, src); |
312 | case 138: |
313 | return MemcpyFixed<138>(dest, src); |
314 | case 139: |
315 | return MemcpyFixed<139>(dest, src); |
316 | case 140: |
317 | return MemcpyFixed<140>(dest, src); |
318 | case 141: |
319 | return MemcpyFixed<141>(dest, src); |
320 | case 142: |
321 | return MemcpyFixed<142>(dest, src); |
322 | case 143: |
323 | return MemcpyFixed<143>(dest, src); |
324 | case 144: |
325 | return MemcpyFixed<144>(dest, src); |
326 | case 145: |
327 | return MemcpyFixed<145>(dest, src); |
328 | case 146: |
329 | return MemcpyFixed<146>(dest, src); |
330 | case 147: |
331 | return MemcpyFixed<147>(dest, src); |
332 | case 148: |
333 | return MemcpyFixed<148>(dest, src); |
334 | case 149: |
335 | return MemcpyFixed<149>(dest, src); |
336 | case 150: |
337 | return MemcpyFixed<150>(dest, src); |
338 | case 151: |
339 | return MemcpyFixed<151>(dest, src); |
340 | case 152: |
341 | return MemcpyFixed<152>(dest, src); |
342 | case 153: |
343 | return MemcpyFixed<153>(dest, src); |
344 | case 154: |
345 | return MemcpyFixed<154>(dest, src); |
346 | case 155: |
347 | return MemcpyFixed<155>(dest, src); |
348 | case 156: |
349 | return MemcpyFixed<156>(dest, src); |
350 | case 157: |
351 | return MemcpyFixed<157>(dest, src); |
352 | case 158: |
353 | return MemcpyFixed<158>(dest, src); |
354 | case 159: |
355 | return MemcpyFixed<159>(dest, src); |
356 | case 160: |
357 | return MemcpyFixed<160>(dest, src); |
358 | case 161: |
359 | return MemcpyFixed<161>(dest, src); |
360 | case 162: |
361 | return MemcpyFixed<162>(dest, src); |
362 | case 163: |
363 | return MemcpyFixed<163>(dest, src); |
364 | case 164: |
365 | return MemcpyFixed<164>(dest, src); |
366 | case 165: |
367 | return MemcpyFixed<165>(dest, src); |
368 | case 166: |
369 | return MemcpyFixed<166>(dest, src); |
370 | case 167: |
371 | return MemcpyFixed<167>(dest, src); |
372 | case 168: |
373 | return MemcpyFixed<168>(dest, src); |
374 | case 169: |
375 | return MemcpyFixed<169>(dest, src); |
376 | case 170: |
377 | return MemcpyFixed<170>(dest, src); |
378 | case 171: |
379 | return MemcpyFixed<171>(dest, src); |
380 | case 172: |
381 | return MemcpyFixed<172>(dest, src); |
382 | case 173: |
383 | return MemcpyFixed<173>(dest, src); |
384 | case 174: |
385 | return MemcpyFixed<174>(dest, src); |
386 | case 175: |
387 | return MemcpyFixed<175>(dest, src); |
388 | case 176: |
389 | return MemcpyFixed<176>(dest, src); |
390 | case 177: |
391 | return MemcpyFixed<177>(dest, src); |
392 | case 178: |
393 | return MemcpyFixed<178>(dest, src); |
394 | case 179: |
395 | return MemcpyFixed<179>(dest, src); |
396 | case 180: |
397 | return MemcpyFixed<180>(dest, src); |
398 | case 181: |
399 | return MemcpyFixed<181>(dest, src); |
400 | case 182: |
401 | return MemcpyFixed<182>(dest, src); |
402 | case 183: |
403 | return MemcpyFixed<183>(dest, src); |
404 | case 184: |
405 | return MemcpyFixed<184>(dest, src); |
406 | case 185: |
407 | return MemcpyFixed<185>(dest, src); |
408 | case 186: |
409 | return MemcpyFixed<186>(dest, src); |
410 | case 187: |
411 | return MemcpyFixed<187>(dest, src); |
412 | case 188: |
413 | return MemcpyFixed<188>(dest, src); |
414 | case 189: |
415 | return MemcpyFixed<189>(dest, src); |
416 | case 190: |
417 | return MemcpyFixed<190>(dest, src); |
418 | case 191: |
419 | return MemcpyFixed<191>(dest, src); |
420 | case 192: |
421 | return MemcpyFixed<192>(dest, src); |
422 | case 193: |
423 | return MemcpyFixed<193>(dest, src); |
424 | case 194: |
425 | return MemcpyFixed<194>(dest, src); |
426 | case 195: |
427 | return MemcpyFixed<195>(dest, src); |
428 | case 196: |
429 | return MemcpyFixed<196>(dest, src); |
430 | case 197: |
431 | return MemcpyFixed<197>(dest, src); |
432 | case 198: |
433 | return MemcpyFixed<198>(dest, src); |
434 | case 199: |
435 | return MemcpyFixed<199>(dest, src); |
436 | case 200: |
437 | return MemcpyFixed<200>(dest, src); |
438 | case 201: |
439 | return MemcpyFixed<201>(dest, src); |
440 | case 202: |
441 | return MemcpyFixed<202>(dest, src); |
442 | case 203: |
443 | return MemcpyFixed<203>(dest, src); |
444 | case 204: |
445 | return MemcpyFixed<204>(dest, src); |
446 | case 205: |
447 | return MemcpyFixed<205>(dest, src); |
448 | case 206: |
449 | return MemcpyFixed<206>(dest, src); |
450 | case 207: |
451 | return MemcpyFixed<207>(dest, src); |
452 | case 208: |
453 | return MemcpyFixed<208>(dest, src); |
454 | case 209: |
455 | return MemcpyFixed<209>(dest, src); |
456 | case 210: |
457 | return MemcpyFixed<210>(dest, src); |
458 | case 211: |
459 | return MemcpyFixed<211>(dest, src); |
460 | case 212: |
461 | return MemcpyFixed<212>(dest, src); |
462 | case 213: |
463 | return MemcpyFixed<213>(dest, src); |
464 | case 214: |
465 | return MemcpyFixed<214>(dest, src); |
466 | case 215: |
467 | return MemcpyFixed<215>(dest, src); |
468 | case 216: |
469 | return MemcpyFixed<216>(dest, src); |
470 | case 217: |
471 | return MemcpyFixed<217>(dest, src); |
472 | case 218: |
473 | return MemcpyFixed<218>(dest, src); |
474 | case 219: |
475 | return MemcpyFixed<219>(dest, src); |
476 | case 220: |
477 | return MemcpyFixed<220>(dest, src); |
478 | case 221: |
479 | return MemcpyFixed<221>(dest, src); |
480 | case 222: |
481 | return MemcpyFixed<222>(dest, src); |
482 | case 223: |
483 | return MemcpyFixed<223>(dest, src); |
484 | case 224: |
485 | return MemcpyFixed<224>(dest, src); |
486 | case 225: |
487 | return MemcpyFixed<225>(dest, src); |
488 | case 226: |
489 | return MemcpyFixed<226>(dest, src); |
490 | case 227: |
491 | return MemcpyFixed<227>(dest, src); |
492 | case 228: |
493 | return MemcpyFixed<228>(dest, src); |
494 | case 229: |
495 | return MemcpyFixed<229>(dest, src); |
496 | case 230: |
497 | return MemcpyFixed<230>(dest, src); |
498 | case 231: |
499 | return MemcpyFixed<231>(dest, src); |
500 | case 232: |
501 | return MemcpyFixed<232>(dest, src); |
502 | case 233: |
503 | return MemcpyFixed<233>(dest, src); |
504 | case 234: |
505 | return MemcpyFixed<234>(dest, src); |
506 | case 235: |
507 | return MemcpyFixed<235>(dest, src); |
508 | case 236: |
509 | return MemcpyFixed<236>(dest, src); |
510 | case 237: |
511 | return MemcpyFixed<237>(dest, src); |
512 | case 238: |
513 | return MemcpyFixed<238>(dest, src); |
514 | case 239: |
515 | return MemcpyFixed<239>(dest, src); |
516 | case 240: |
517 | return MemcpyFixed<240>(dest, src); |
518 | case 241: |
519 | return MemcpyFixed<241>(dest, src); |
520 | case 242: |
521 | return MemcpyFixed<242>(dest, src); |
522 | case 243: |
523 | return MemcpyFixed<243>(dest, src); |
524 | case 244: |
525 | return MemcpyFixed<244>(dest, src); |
526 | case 245: |
527 | return MemcpyFixed<245>(dest, src); |
528 | case 246: |
529 | return MemcpyFixed<246>(dest, src); |
530 | case 247: |
531 | return MemcpyFixed<247>(dest, src); |
532 | case 248: |
533 | return MemcpyFixed<248>(dest, src); |
534 | case 249: |
535 | return MemcpyFixed<249>(dest, src); |
536 | case 250: |
537 | return MemcpyFixed<250>(dest, src); |
538 | case 251: |
539 | return MemcpyFixed<251>(dest, src); |
540 | case 252: |
541 | return MemcpyFixed<252>(dest, src); |
542 | case 253: |
543 | return MemcpyFixed<253>(dest, src); |
544 | case 254: |
545 | return MemcpyFixed<254>(dest, src); |
546 | case 255: |
547 | return MemcpyFixed<255>(dest, src); |
548 | case 256: |
549 | return MemcpyFixed<256>(dest, src); |
550 | default: |
551 | memcpy(dest: dest, src: src, n: size); |
552 | } |
553 | // LCOV_EXCL_STOP |
554 | } |
555 | |
556 | //! This templated memcmp is significantly faster than std::memcmp, |
557 | //! but only when you are calling memcmp with a const size in a loop. |
558 | //! For instance `while (<cond>) { memcmp(<str1>, <str2>, const_size); ... }` |
559 | static inline int FastMemcmp(const void *str1, const void *str2, const size_t size) { |
560 | // LCOV_EXCL_START |
561 | switch (size) { |
562 | case 0: |
563 | return 0; |
564 | case 1: |
565 | return MemcmpFixed<1>(str1, str2); |
566 | case 2: |
567 | return MemcmpFixed<2>(str1, str2); |
568 | case 3: |
569 | return MemcmpFixed<3>(str1, str2); |
570 | case 4: |
571 | return MemcmpFixed<4>(str1, str2); |
572 | case 5: |
573 | return MemcmpFixed<5>(str1, str2); |
574 | case 6: |
575 | return MemcmpFixed<6>(str1, str2); |
576 | case 7: |
577 | return MemcmpFixed<7>(str1, str2); |
578 | case 8: |
579 | return MemcmpFixed<8>(str1, str2); |
580 | case 9: |
581 | return MemcmpFixed<9>(str1, str2); |
582 | case 10: |
583 | return MemcmpFixed<10>(str1, str2); |
584 | case 11: |
585 | return MemcmpFixed<11>(str1, str2); |
586 | case 12: |
587 | return MemcmpFixed<12>(str1, str2); |
588 | case 13: |
589 | return MemcmpFixed<13>(str1, str2); |
590 | case 14: |
591 | return MemcmpFixed<14>(str1, str2); |
592 | case 15: |
593 | return MemcmpFixed<15>(str1, str2); |
594 | case 16: |
595 | return MemcmpFixed<16>(str1, str2); |
596 | case 17: |
597 | return MemcmpFixed<17>(str1, str2); |
598 | case 18: |
599 | return MemcmpFixed<18>(str1, str2); |
600 | case 19: |
601 | return MemcmpFixed<19>(str1, str2); |
602 | case 20: |
603 | return MemcmpFixed<20>(str1, str2); |
604 | case 21: |
605 | return MemcmpFixed<21>(str1, str2); |
606 | case 22: |
607 | return MemcmpFixed<22>(str1, str2); |
608 | case 23: |
609 | return MemcmpFixed<23>(str1, str2); |
610 | case 24: |
611 | return MemcmpFixed<24>(str1, str2); |
612 | case 25: |
613 | return MemcmpFixed<25>(str1, str2); |
614 | case 26: |
615 | return MemcmpFixed<26>(str1, str2); |
616 | case 27: |
617 | return MemcmpFixed<27>(str1, str2); |
618 | case 28: |
619 | return MemcmpFixed<28>(str1, str2); |
620 | case 29: |
621 | return MemcmpFixed<29>(str1, str2); |
622 | case 30: |
623 | return MemcmpFixed<30>(str1, str2); |
624 | case 31: |
625 | return MemcmpFixed<31>(str1, str2); |
626 | case 32: |
627 | return MemcmpFixed<32>(str1, str2); |
628 | case 33: |
629 | return MemcmpFixed<33>(str1, str2); |
630 | case 34: |
631 | return MemcmpFixed<34>(str1, str2); |
632 | case 35: |
633 | return MemcmpFixed<35>(str1, str2); |
634 | case 36: |
635 | return MemcmpFixed<36>(str1, str2); |
636 | case 37: |
637 | return MemcmpFixed<37>(str1, str2); |
638 | case 38: |
639 | return MemcmpFixed<38>(str1, str2); |
640 | case 39: |
641 | return MemcmpFixed<39>(str1, str2); |
642 | case 40: |
643 | return MemcmpFixed<40>(str1, str2); |
644 | case 41: |
645 | return MemcmpFixed<41>(str1, str2); |
646 | case 42: |
647 | return MemcmpFixed<42>(str1, str2); |
648 | case 43: |
649 | return MemcmpFixed<43>(str1, str2); |
650 | case 44: |
651 | return MemcmpFixed<44>(str1, str2); |
652 | case 45: |
653 | return MemcmpFixed<45>(str1, str2); |
654 | case 46: |
655 | return MemcmpFixed<46>(str1, str2); |
656 | case 47: |
657 | return MemcmpFixed<47>(str1, str2); |
658 | case 48: |
659 | return MemcmpFixed<48>(str1, str2); |
660 | case 49: |
661 | return MemcmpFixed<49>(str1, str2); |
662 | case 50: |
663 | return MemcmpFixed<50>(str1, str2); |
664 | case 51: |
665 | return MemcmpFixed<51>(str1, str2); |
666 | case 52: |
667 | return MemcmpFixed<52>(str1, str2); |
668 | case 53: |
669 | return MemcmpFixed<53>(str1, str2); |
670 | case 54: |
671 | return MemcmpFixed<54>(str1, str2); |
672 | case 55: |
673 | return MemcmpFixed<55>(str1, str2); |
674 | case 56: |
675 | return MemcmpFixed<56>(str1, str2); |
676 | case 57: |
677 | return MemcmpFixed<57>(str1, str2); |
678 | case 58: |
679 | return MemcmpFixed<58>(str1, str2); |
680 | case 59: |
681 | return MemcmpFixed<59>(str1, str2); |
682 | case 60: |
683 | return MemcmpFixed<60>(str1, str2); |
684 | case 61: |
685 | return MemcmpFixed<61>(str1, str2); |
686 | case 62: |
687 | return MemcmpFixed<62>(str1, str2); |
688 | case 63: |
689 | return MemcmpFixed<63>(str1, str2); |
690 | case 64: |
691 | return MemcmpFixed<64>(str1, str2); |
692 | default: |
693 | return memcmp(s1: str1, s2: str2, n: size); |
694 | } |
695 | // LCOV_EXCL_STOP |
696 | } |
697 | |
698 | static inline void FastMemset(void *ptr, int value, size_t size) { |
699 | // LCOV_EXCL_START |
700 | switch (size) { |
701 | case 0: |
702 | return; |
703 | case 1: |
704 | return MemsetFixed<1>(ptr, value); |
705 | case 2: |
706 | return MemsetFixed<2>(ptr, value); |
707 | case 3: |
708 | return MemsetFixed<3>(ptr, value); |
709 | case 4: |
710 | return MemsetFixed<4>(ptr, value); |
711 | case 5: |
712 | return MemsetFixed<5>(ptr, value); |
713 | case 6: |
714 | return MemsetFixed<6>(ptr, value); |
715 | case 7: |
716 | return MemsetFixed<7>(ptr, value); |
717 | case 8: |
718 | return MemsetFixed<8>(ptr, value); |
719 | case 9: |
720 | return MemsetFixed<9>(ptr, value); |
721 | case 10: |
722 | return MemsetFixed<10>(ptr, value); |
723 | case 11: |
724 | return MemsetFixed<11>(ptr, value); |
725 | case 12: |
726 | return MemsetFixed<12>(ptr, value); |
727 | case 13: |
728 | return MemsetFixed<13>(ptr, value); |
729 | case 14: |
730 | return MemsetFixed<14>(ptr, value); |
731 | case 15: |
732 | return MemsetFixed<15>(ptr, value); |
733 | case 16: |
734 | return MemsetFixed<16>(ptr, value); |
735 | case 17: |
736 | return MemsetFixed<17>(ptr, value); |
737 | case 18: |
738 | return MemsetFixed<18>(ptr, value); |
739 | case 19: |
740 | return MemsetFixed<19>(ptr, value); |
741 | case 20: |
742 | return MemsetFixed<20>(ptr, value); |
743 | case 21: |
744 | return MemsetFixed<21>(ptr, value); |
745 | case 22: |
746 | return MemsetFixed<22>(ptr, value); |
747 | case 23: |
748 | return MemsetFixed<23>(ptr, value); |
749 | case 24: |
750 | return MemsetFixed<24>(ptr, value); |
751 | case 25: |
752 | return MemsetFixed<25>(ptr, value); |
753 | case 26: |
754 | return MemsetFixed<26>(ptr, value); |
755 | case 27: |
756 | return MemsetFixed<27>(ptr, value); |
757 | case 28: |
758 | return MemsetFixed<28>(ptr, value); |
759 | case 29: |
760 | return MemsetFixed<29>(ptr, value); |
761 | case 30: |
762 | return MemsetFixed<30>(ptr, value); |
763 | case 31: |
764 | return MemsetFixed<31>(ptr, value); |
765 | case 32: |
766 | return MemsetFixed<32>(ptr, value); |
767 | case 33: |
768 | return MemsetFixed<33>(ptr, value); |
769 | case 34: |
770 | return MemsetFixed<34>(ptr, value); |
771 | case 35: |
772 | return MemsetFixed<35>(ptr, value); |
773 | case 36: |
774 | return MemsetFixed<36>(ptr, value); |
775 | case 37: |
776 | return MemsetFixed<37>(ptr, value); |
777 | case 38: |
778 | return MemsetFixed<38>(ptr, value); |
779 | case 39: |
780 | return MemsetFixed<39>(ptr, value); |
781 | case 40: |
782 | return MemsetFixed<40>(ptr, value); |
783 | case 41: |
784 | return MemsetFixed<41>(ptr, value); |
785 | case 42: |
786 | return MemsetFixed<42>(ptr, value); |
787 | case 43: |
788 | return MemsetFixed<43>(ptr, value); |
789 | case 44: |
790 | return MemsetFixed<44>(ptr, value); |
791 | case 45: |
792 | return MemsetFixed<45>(ptr, value); |
793 | case 46: |
794 | return MemsetFixed<46>(ptr, value); |
795 | case 47: |
796 | return MemsetFixed<47>(ptr, value); |
797 | case 48: |
798 | return MemsetFixed<48>(ptr, value); |
799 | case 49: |
800 | return MemsetFixed<49>(ptr, value); |
801 | case 50: |
802 | return MemsetFixed<50>(ptr, value); |
803 | case 51: |
804 | return MemsetFixed<51>(ptr, value); |
805 | case 52: |
806 | return MemsetFixed<52>(ptr, value); |
807 | case 53: |
808 | return MemsetFixed<53>(ptr, value); |
809 | case 54: |
810 | return MemsetFixed<54>(ptr, value); |
811 | case 55: |
812 | return MemsetFixed<55>(ptr, value); |
813 | case 56: |
814 | return MemsetFixed<56>(ptr, value); |
815 | case 57: |
816 | return MemsetFixed<57>(ptr, value); |
817 | case 58: |
818 | return MemsetFixed<58>(ptr, value); |
819 | case 59: |
820 | return MemsetFixed<59>(ptr, value); |
821 | case 60: |
822 | return MemsetFixed<60>(ptr, value); |
823 | case 61: |
824 | return MemsetFixed<61>(ptr, value); |
825 | case 62: |
826 | return MemsetFixed<62>(ptr, value); |
827 | case 63: |
828 | return MemsetFixed<63>(ptr, value); |
829 | case 64: |
830 | return MemsetFixed<64>(ptr, value); |
831 | case 65: |
832 | return MemsetFixed<65>(ptr, value); |
833 | case 66: |
834 | return MemsetFixed<66>(ptr, value); |
835 | case 67: |
836 | return MemsetFixed<67>(ptr, value); |
837 | case 68: |
838 | return MemsetFixed<68>(ptr, value); |
839 | case 69: |
840 | return MemsetFixed<69>(ptr, value); |
841 | case 70: |
842 | return MemsetFixed<70>(ptr, value); |
843 | case 71: |
844 | return MemsetFixed<71>(ptr, value); |
845 | case 72: |
846 | return MemsetFixed<72>(ptr, value); |
847 | case 73: |
848 | return MemsetFixed<73>(ptr, value); |
849 | case 74: |
850 | return MemsetFixed<74>(ptr, value); |
851 | case 75: |
852 | return MemsetFixed<75>(ptr, value); |
853 | case 76: |
854 | return MemsetFixed<76>(ptr, value); |
855 | case 77: |
856 | return MemsetFixed<77>(ptr, value); |
857 | case 78: |
858 | return MemsetFixed<78>(ptr, value); |
859 | case 79: |
860 | return MemsetFixed<79>(ptr, value); |
861 | case 80: |
862 | return MemsetFixed<80>(ptr, value); |
863 | case 81: |
864 | return MemsetFixed<81>(ptr, value); |
865 | case 82: |
866 | return MemsetFixed<82>(ptr, value); |
867 | case 83: |
868 | return MemsetFixed<83>(ptr, value); |
869 | case 84: |
870 | return MemsetFixed<84>(ptr, value); |
871 | case 85: |
872 | return MemsetFixed<85>(ptr, value); |
873 | case 86: |
874 | return MemsetFixed<86>(ptr, value); |
875 | case 87: |
876 | return MemsetFixed<87>(ptr, value); |
877 | case 88: |
878 | return MemsetFixed<88>(ptr, value); |
879 | case 89: |
880 | return MemsetFixed<89>(ptr, value); |
881 | case 90: |
882 | return MemsetFixed<90>(ptr, value); |
883 | case 91: |
884 | return MemsetFixed<91>(ptr, value); |
885 | case 92: |
886 | return MemsetFixed<92>(ptr, value); |
887 | case 93: |
888 | return MemsetFixed<93>(ptr, value); |
889 | case 94: |
890 | return MemsetFixed<94>(ptr, value); |
891 | case 95: |
892 | return MemsetFixed<95>(ptr, value); |
893 | case 96: |
894 | return MemsetFixed<96>(ptr, value); |
895 | case 97: |
896 | return MemsetFixed<97>(ptr, value); |
897 | case 98: |
898 | return MemsetFixed<98>(ptr, value); |
899 | case 99: |
900 | return MemsetFixed<99>(ptr, value); |
901 | case 100: |
902 | return MemsetFixed<100>(ptr, value); |
903 | case 101: |
904 | return MemsetFixed<101>(ptr, value); |
905 | case 102: |
906 | return MemsetFixed<102>(ptr, value); |
907 | case 103: |
908 | return MemsetFixed<103>(ptr, value); |
909 | case 104: |
910 | return MemsetFixed<104>(ptr, value); |
911 | case 105: |
912 | return MemsetFixed<105>(ptr, value); |
913 | case 106: |
914 | return MemsetFixed<106>(ptr, value); |
915 | case 107: |
916 | return MemsetFixed<107>(ptr, value); |
917 | case 108: |
918 | return MemsetFixed<108>(ptr, value); |
919 | case 109: |
920 | return MemsetFixed<109>(ptr, value); |
921 | case 110: |
922 | return MemsetFixed<110>(ptr, value); |
923 | case 111: |
924 | return MemsetFixed<111>(ptr, value); |
925 | case 112: |
926 | return MemsetFixed<112>(ptr, value); |
927 | case 113: |
928 | return MemsetFixed<113>(ptr, value); |
929 | case 114: |
930 | return MemsetFixed<114>(ptr, value); |
931 | case 115: |
932 | return MemsetFixed<115>(ptr, value); |
933 | case 116: |
934 | return MemsetFixed<116>(ptr, value); |
935 | case 117: |
936 | return MemsetFixed<117>(ptr, value); |
937 | case 118: |
938 | return MemsetFixed<118>(ptr, value); |
939 | case 119: |
940 | return MemsetFixed<119>(ptr, value); |
941 | case 120: |
942 | return MemsetFixed<120>(ptr, value); |
943 | case 121: |
944 | return MemsetFixed<121>(ptr, value); |
945 | case 122: |
946 | return MemsetFixed<122>(ptr, value); |
947 | case 123: |
948 | return MemsetFixed<123>(ptr, value); |
949 | case 124: |
950 | return MemsetFixed<124>(ptr, value); |
951 | case 125: |
952 | return MemsetFixed<125>(ptr, value); |
953 | case 126: |
954 | return MemsetFixed<126>(ptr, value); |
955 | case 127: |
956 | return MemsetFixed<127>(ptr, value); |
957 | case 128: |
958 | return MemsetFixed<128>(ptr, value); |
959 | case 129: |
960 | return MemsetFixed<129>(ptr, value); |
961 | case 130: |
962 | return MemsetFixed<130>(ptr, value); |
963 | case 131: |
964 | return MemsetFixed<131>(ptr, value); |
965 | case 132: |
966 | return MemsetFixed<132>(ptr, value); |
967 | case 133: |
968 | return MemsetFixed<133>(ptr, value); |
969 | case 134: |
970 | return MemsetFixed<134>(ptr, value); |
971 | case 135: |
972 | return MemsetFixed<135>(ptr, value); |
973 | case 136: |
974 | return MemsetFixed<136>(ptr, value); |
975 | case 137: |
976 | return MemsetFixed<137>(ptr, value); |
977 | case 138: |
978 | return MemsetFixed<138>(ptr, value); |
979 | case 139: |
980 | return MemsetFixed<139>(ptr, value); |
981 | case 140: |
982 | return MemsetFixed<140>(ptr, value); |
983 | case 141: |
984 | return MemsetFixed<141>(ptr, value); |
985 | case 142: |
986 | return MemsetFixed<142>(ptr, value); |
987 | case 143: |
988 | return MemsetFixed<143>(ptr, value); |
989 | case 144: |
990 | return MemsetFixed<144>(ptr, value); |
991 | case 145: |
992 | return MemsetFixed<145>(ptr, value); |
993 | case 146: |
994 | return MemsetFixed<146>(ptr, value); |
995 | case 147: |
996 | return MemsetFixed<147>(ptr, value); |
997 | case 148: |
998 | return MemsetFixed<148>(ptr, value); |
999 | case 149: |
1000 | return MemsetFixed<149>(ptr, value); |
1001 | case 150: |
1002 | return MemsetFixed<150>(ptr, value); |
1003 | case 151: |
1004 | return MemsetFixed<151>(ptr, value); |
1005 | case 152: |
1006 | return MemsetFixed<152>(ptr, value); |
1007 | case 153: |
1008 | return MemsetFixed<153>(ptr, value); |
1009 | case 154: |
1010 | return MemsetFixed<154>(ptr, value); |
1011 | case 155: |
1012 | return MemsetFixed<155>(ptr, value); |
1013 | case 156: |
1014 | return MemsetFixed<156>(ptr, value); |
1015 | case 157: |
1016 | return MemsetFixed<157>(ptr, value); |
1017 | case 158: |
1018 | return MemsetFixed<158>(ptr, value); |
1019 | case 159: |
1020 | return MemsetFixed<159>(ptr, value); |
1021 | case 160: |
1022 | return MemsetFixed<160>(ptr, value); |
1023 | case 161: |
1024 | return MemsetFixed<161>(ptr, value); |
1025 | case 162: |
1026 | return MemsetFixed<162>(ptr, value); |
1027 | case 163: |
1028 | return MemsetFixed<163>(ptr, value); |
1029 | case 164: |
1030 | return MemsetFixed<164>(ptr, value); |
1031 | case 165: |
1032 | return MemsetFixed<165>(ptr, value); |
1033 | case 166: |
1034 | return MemsetFixed<166>(ptr, value); |
1035 | case 167: |
1036 | return MemsetFixed<167>(ptr, value); |
1037 | case 168: |
1038 | return MemsetFixed<168>(ptr, value); |
1039 | case 169: |
1040 | return MemsetFixed<169>(ptr, value); |
1041 | case 170: |
1042 | return MemsetFixed<170>(ptr, value); |
1043 | case 171: |
1044 | return MemsetFixed<171>(ptr, value); |
1045 | case 172: |
1046 | return MemsetFixed<172>(ptr, value); |
1047 | case 173: |
1048 | return MemsetFixed<173>(ptr, value); |
1049 | case 174: |
1050 | return MemsetFixed<174>(ptr, value); |
1051 | case 175: |
1052 | return MemsetFixed<175>(ptr, value); |
1053 | case 176: |
1054 | return MemsetFixed<176>(ptr, value); |
1055 | case 177: |
1056 | return MemsetFixed<177>(ptr, value); |
1057 | case 178: |
1058 | return MemsetFixed<178>(ptr, value); |
1059 | case 179: |
1060 | return MemsetFixed<179>(ptr, value); |
1061 | case 180: |
1062 | return MemsetFixed<180>(ptr, value); |
1063 | case 181: |
1064 | return MemsetFixed<181>(ptr, value); |
1065 | case 182: |
1066 | return MemsetFixed<182>(ptr, value); |
1067 | case 183: |
1068 | return MemsetFixed<183>(ptr, value); |
1069 | case 184: |
1070 | return MemsetFixed<184>(ptr, value); |
1071 | case 185: |
1072 | return MemsetFixed<185>(ptr, value); |
1073 | case 186: |
1074 | return MemsetFixed<186>(ptr, value); |
1075 | case 187: |
1076 | return MemsetFixed<187>(ptr, value); |
1077 | case 188: |
1078 | return MemsetFixed<188>(ptr, value); |
1079 | case 189: |
1080 | return MemsetFixed<189>(ptr, value); |
1081 | case 190: |
1082 | return MemsetFixed<190>(ptr, value); |
1083 | case 191: |
1084 | return MemsetFixed<191>(ptr, value); |
1085 | case 192: |
1086 | return MemsetFixed<192>(ptr, value); |
1087 | case 193: |
1088 | return MemsetFixed<193>(ptr, value); |
1089 | case 194: |
1090 | return MemsetFixed<194>(ptr, value); |
1091 | case 195: |
1092 | return MemsetFixed<195>(ptr, value); |
1093 | case 196: |
1094 | return MemsetFixed<196>(ptr, value); |
1095 | case 197: |
1096 | return MemsetFixed<197>(ptr, value); |
1097 | case 198: |
1098 | return MemsetFixed<198>(ptr, value); |
1099 | case 199: |
1100 | return MemsetFixed<199>(ptr, value); |
1101 | case 200: |
1102 | return MemsetFixed<200>(ptr, value); |
1103 | case 201: |
1104 | return MemsetFixed<201>(ptr, value); |
1105 | case 202: |
1106 | return MemsetFixed<202>(ptr, value); |
1107 | case 203: |
1108 | return MemsetFixed<203>(ptr, value); |
1109 | case 204: |
1110 | return MemsetFixed<204>(ptr, value); |
1111 | case 205: |
1112 | return MemsetFixed<205>(ptr, value); |
1113 | case 206: |
1114 | return MemsetFixed<206>(ptr, value); |
1115 | case 207: |
1116 | return MemsetFixed<207>(ptr, value); |
1117 | case 208: |
1118 | return MemsetFixed<208>(ptr, value); |
1119 | case 209: |
1120 | return MemsetFixed<209>(ptr, value); |
1121 | case 210: |
1122 | return MemsetFixed<210>(ptr, value); |
1123 | case 211: |
1124 | return MemsetFixed<211>(ptr, value); |
1125 | case 212: |
1126 | return MemsetFixed<212>(ptr, value); |
1127 | case 213: |
1128 | return MemsetFixed<213>(ptr, value); |
1129 | case 214: |
1130 | return MemsetFixed<214>(ptr, value); |
1131 | case 215: |
1132 | return MemsetFixed<215>(ptr, value); |
1133 | case 216: |
1134 | return MemsetFixed<216>(ptr, value); |
1135 | case 217: |
1136 | return MemsetFixed<217>(ptr, value); |
1137 | case 218: |
1138 | return MemsetFixed<218>(ptr, value); |
1139 | case 219: |
1140 | return MemsetFixed<219>(ptr, value); |
1141 | case 220: |
1142 | return MemsetFixed<220>(ptr, value); |
1143 | case 221: |
1144 | return MemsetFixed<221>(ptr, value); |
1145 | case 222: |
1146 | return MemsetFixed<222>(ptr, value); |
1147 | case 223: |
1148 | return MemsetFixed<223>(ptr, value); |
1149 | case 224: |
1150 | return MemsetFixed<224>(ptr, value); |
1151 | case 225: |
1152 | return MemsetFixed<225>(ptr, value); |
1153 | case 226: |
1154 | return MemsetFixed<226>(ptr, value); |
1155 | case 227: |
1156 | return MemsetFixed<227>(ptr, value); |
1157 | case 228: |
1158 | return MemsetFixed<228>(ptr, value); |
1159 | case 229: |
1160 | return MemsetFixed<229>(ptr, value); |
1161 | case 230: |
1162 | return MemsetFixed<230>(ptr, value); |
1163 | case 231: |
1164 | return MemsetFixed<231>(ptr, value); |
1165 | case 232: |
1166 | return MemsetFixed<232>(ptr, value); |
1167 | case 233: |
1168 | return MemsetFixed<233>(ptr, value); |
1169 | case 234: |
1170 | return MemsetFixed<234>(ptr, value); |
1171 | case 235: |
1172 | return MemsetFixed<235>(ptr, value); |
1173 | case 236: |
1174 | return MemsetFixed<236>(ptr, value); |
1175 | case 237: |
1176 | return MemsetFixed<237>(ptr, value); |
1177 | case 238: |
1178 | return MemsetFixed<238>(ptr, value); |
1179 | case 239: |
1180 | return MemsetFixed<239>(ptr, value); |
1181 | case 240: |
1182 | return MemsetFixed<240>(ptr, value); |
1183 | case 241: |
1184 | return MemsetFixed<241>(ptr, value); |
1185 | case 242: |
1186 | return MemsetFixed<242>(ptr, value); |
1187 | case 243: |
1188 | return MemsetFixed<243>(ptr, value); |
1189 | case 244: |
1190 | return MemsetFixed<244>(ptr, value); |
1191 | case 245: |
1192 | return MemsetFixed<245>(ptr, value); |
1193 | case 246: |
1194 | return MemsetFixed<246>(ptr, value); |
1195 | case 247: |
1196 | return MemsetFixed<247>(ptr, value); |
1197 | case 248: |
1198 | return MemsetFixed<248>(ptr, value); |
1199 | case 249: |
1200 | return MemsetFixed<249>(ptr, value); |
1201 | case 250: |
1202 | return MemsetFixed<250>(ptr, value); |
1203 | case 251: |
1204 | return MemsetFixed<251>(ptr, value); |
1205 | case 252: |
1206 | return MemsetFixed<252>(ptr, value); |
1207 | case 253: |
1208 | return MemsetFixed<253>(ptr, value); |
1209 | case 254: |
1210 | return MemsetFixed<254>(ptr, value); |
1211 | case 255: |
1212 | return MemsetFixed<255>(ptr, value); |
1213 | case 256: |
1214 | return MemsetFixed<256>(ptr, value); |
1215 | default: |
1216 | memset(s: ptr, c: value, n: size); |
1217 | } |
1218 | // LCOV_EXCL_STOP |
1219 | } |
1220 | |
1221 | } // namespace duckdb |
1222 | |