LCOV - code coverage report
Current view: top level - oks/include/oks - cstring.hpp (source / functions) Coverage Total Hit
Test: code.result Lines: 91.3 % 46 42
Test Date: 2026-10-11 15:05:20 Functions: 91.3 % 23 21

            Line data    Source code
       1              : // DUNE DAQ modification notice:
       2              : // This file has been modified from the original ATLAS oks source for the DUNE DAQ project.
       3              : // Fork baseline commit: oks-08-03-04 (2022-04-14).
       4              : // Renamed since fork: yes (from oks/cstring.h to include/oks/cstring.hpp).
       5              : 
       6              : #ifndef OKS_CSTRING_CMP_H
       7              : #define OKS_CSTRING_CMP_H
       8              : 
       9              : #include <stdint.h>
      10              : 
      11              : namespace dunedaq {
      12              : namespace oks {
      13              : 
      14              : inline bool
      15       544760 : cmp_str1(const char* s1, const char s2[2])
      16              : {
      17       544760 :   return (*(const int16_t*)s1 == *(const int16_t*)s2);
      18              : }
      19              : 
      20              : inline bool
      21        54028 : cmp_str2(const char* s1, const char s2[3])
      22              : {
      23        54028 :   return cmp_str1(s1, s2) && (s1[2] == 0);
      24              : }
      25              : 
      26              : inline bool
      27        31482 : cmp_str2n(const char* s1, const char s2[2])
      28              : {
      29        31482 :   return cmp_str1(s1, s2);
      30              : }
      31              : 
      32              : inline bool
      33       923880 : cmp_str3(const char* s1, const char s2[4])
      34              : {
      35       923880 :   return (*(const int32_t*)s1 == *(const int32_t*)s2);
      36              : }
      37              : 
      38              : inline bool
      39       149158 : cmp_str3n(const char* s1, const char s2[3])
      40              : {
      41       149158 :   return (s1[0] == s2[0]) && cmp_str1(s1 + 1, s2 + 1);
      42              : }
      43              : 
      44              : inline bool
      45       269106 : cmp_str4(const char* s1, const char s2[5])
      46              : {
      47       269106 :   return (s1[0] == s2[0]) && cmp_str3(s1 + 1, s2 + 1);
      48              : }
      49              : 
      50              : inline bool
      51       592516 : cmp_str4n(const char* s1, const char s2[4])
      52              : {
      53       592516 :   return cmp_str3(s1, s2);
      54              : }
      55              : 
      56              : inline bool
      57        44008 : cmp_str5(const char* s1, const char s2[6])
      58              : {
      59        44008 :   return cmp_str1(s1, s2) && cmp_str3(s1 + 2, s2 + 2);
      60              : }
      61              : 
      62              : inline bool
      63         1119 : cmp_str5n(const char* s1, const char s2[5])
      64              : {
      65         1119 :   return cmp_str3(s1, s2) && (s1[4] == s2[4]);
      66              : }
      67              : 
      68              : inline bool
      69        89957 : cmp_str6(const char* s1, const char s2[7])
      70              : {
      71        89957 :   return cmp_str3(s1, s2) && cmp_str2(s1 + 4, s2 + 4);
      72              : }
      73              : 
      74              : inline bool
      75        10036 : cmp_str6n(const char* s1, const char s2[6])
      76              : {
      77        10036 :   return cmp_str3(s1, s2) && cmp_str1(s1 + 4, s2 + 4);
      78              : }
      79              : 
      80              : inline bool
      81       321609 : cmp_str7(const char* s1, const char s2[8])
      82              : {
      83       321609 :   return (*(const int64_t*)s1 == *(const int64_t*)s2);
      84              : }
      85              : 
      86              : inline bool
      87            0 : cmp_str7n(const char* s1, const char s2[8])
      88              : {
      89            0 :   return (cmp_str3(s1, s2) && cmp_str3n(s1 + 4, s2 + 4));
      90              : }
      91              : 
      92              : inline bool
      93        11182 : cmp_str8(const char* s1, const char s2[9])
      94              : {
      95        11182 :   return cmp_str7(s1, s2) && (s1[8] == 0);
      96              : }
      97              : 
      98              : inline bool
      99            0 : cmp_str8n(const char* s1, const char s2[9])
     100              : {
     101            0 :   return (*(const int64_t*)s1 == *(const int64_t*)s2);
     102              : }
     103              : 
     104              : inline bool
     105        28701 : cmp_str9(const char* s1, const char s2[10])
     106              : {
     107        28701 :   return cmp_str1(s1, s2) && cmp_str7(s1 + 2, s2 + 2);
     108              : }
     109              : 
     110              : inline bool
     111        92204 : cmp_str10(const char* s1, const char s2[11])
     112              : {
     113        92204 :   return cmp_str7(s1, s2) && cmp_str2(s1 + 8, s2 + 8);
     114              : }
     115              : 
     116              : inline bool
     117        95587 : cmp_str11(const char* s1, const char s2[12])
     118              : {
     119        95587 :   return cmp_str7(s1, s2) && cmp_str3(s1 + 8, s2 + 8);
     120              : }
     121              : 
     122              : inline bool
     123        49603 : cmp_str12(const char* s1, const char s2[13])
     124              : {
     125        49603 :   return cmp_str7(s1, s2) && cmp_str4(s1 + 8, s2 + 8);
     126              : }
     127              : 
     128              : inline bool
     129         2133 : cmp_str13(const char* s1, const char s2[14])
     130              : {
     131         2133 :   return cmp_str7(s1, s2) && cmp_str5(s1 + 8, s2 + 8);
     132              : }
     133              : 
     134              : inline bool
     135        16724 : cmp_str14(const char* s1, const char s2[14])
     136              : {
     137        16724 :   return cmp_str7(s1, s2) && cmp_str6(s1 + 8, s2 + 8);
     138              : }
     139              : 
     140              : inline bool
     141          945 : cmp_str15(const char* s1, const char s2[16])
     142              : {
     143          945 :   return cmp_str7(s1, s2) && cmp_str7(s1 + 8, s2 + 8);
     144              : }
     145              : 
     146              : inline bool
     147         1575 : cmp_str16(const char* s1, const char s2[17])
     148              : {
     149         1575 :   return cmp_str7(s1, s2) && cmp_str7(s1 + 8, s2 + 8) && (s1[16] == 0);
     150              : }
     151              : 
     152              : } // namespace oks
     153              : } // namespace dunedaq
     154              : 
     155              : #endif
        

Generated by: LCOV version 2.0-1