This templated memcmp is significantly faster than std::memcmp, but only when you are calling memcmp with a const size in a loop. For instance `while ( ) { memcmp( , , const_size); ... }`
| 545 | //! but only when you are calling memcmp with a const size in a loop. |
| 546 | //! For instance `while (<cond>) { memcmp(<str1>, <str2>, const_size); ... }` |
| 547 | static inline int FastMemcmp(const void* str1, const void* str2, const size_t size) { |
| 548 | // LCOV_EXCL_START |
| 549 | switch (size) { |
| 550 | case 0: |
| 551 | return 0; |
| 552 | case 1: |
| 553 | return MemcmpFixed<1>(str1, str2); |
| 554 | case 2: |
| 555 | return MemcmpFixed<2>(str1, str2); |
| 556 | case 3: |
| 557 | return MemcmpFixed<3>(str1, str2); |
| 558 | case 4: |
| 559 | return MemcmpFixed<4>(str1, str2); |
| 560 | case 5: |
| 561 | return MemcmpFixed<5>(str1, str2); |
| 562 | case 6: |
| 563 | return MemcmpFixed<6>(str1, str2); |
| 564 | case 7: |
| 565 | return MemcmpFixed<7>(str1, str2); |
| 566 | case 8: |
| 567 | return MemcmpFixed<8>(str1, str2); |
| 568 | case 9: |
| 569 | return MemcmpFixed<9>(str1, str2); |
| 570 | case 10: |
| 571 | return MemcmpFixed<10>(str1, str2); |
| 572 | case 11: |
| 573 | return MemcmpFixed<11>(str1, str2); |
| 574 | case 12: |
| 575 | return MemcmpFixed<12>(str1, str2); |
| 576 | case 13: |
| 577 | return MemcmpFixed<13>(str1, str2); |
| 578 | case 14: |
| 579 | return MemcmpFixed<14>(str1, str2); |
| 580 | case 15: |
| 581 | return MemcmpFixed<15>(str1, str2); |
| 582 | case 16: |
| 583 | return MemcmpFixed<16>(str1, str2); |
| 584 | case 17: |
| 585 | return MemcmpFixed<17>(str1, str2); |
| 586 | case 18: |
| 587 | return MemcmpFixed<18>(str1, str2); |
| 588 | case 19: |
| 589 | return MemcmpFixed<19>(str1, str2); |
| 590 | case 20: |
| 591 | return MemcmpFixed<20>(str1, str2); |
| 592 | case 21: |
| 593 | return MemcmpFixed<21>(str1, str2); |
| 594 | case 22: |
| 595 | return MemcmpFixed<22>(str1, str2); |
| 596 | case 23: |
| 597 | return MemcmpFixed<23>(str1, str2); |
| 598 | case 24: |
| 599 | return MemcmpFixed<24>(str1, str2); |
| 600 | case 25: |
| 601 | return MemcmpFixed<25>(str1, str2); |
| 602 | case 26: |
| 603 | return MemcmpFixed<26>(str1, str2); |
| 604 | case 27: |
nothing calls this directly
no outgoing calls
no test coverage detected