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-08-30 15:04:40 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       482910 :   inline bool cmp_str1(const char * s1, const char s2[2]) {
      15       482910 :     return (*(const int16_t *)s1 == *(const int16_t *)s2);
      16              :   }
      17              : 
      18        47254 :   inline bool cmp_str2(const char * s1, const char s2[3]) {
      19        47254 :     return cmp_str1(s1,s2) && (s1[2] == 0);
      20              :   }
      21              : 
      22        28666 :   inline bool cmp_str2n(const char * s1, const char s2[2]) {
      23        28666 :     return cmp_str1(s1,s2);
      24              :   }
      25              : 
      26       817532 :   inline bool cmp_str3(const char * s1, const char s2[4]) {
      27       817532 :     return (*(const int32_t *)s1 == *(const int32_t *)s2);
      28              :   }
      29              : 
      30       133192 :   inline bool cmp_str3n(const char * s1, const char s2[3]) {
      31       133192 :     return (s1[0] == s2[0]) && cmp_str1(s1+1,s2+1);
      32              :   }
      33              : 
      34       235465 :   inline bool cmp_str4(const char * s1, const char s2[5]) {
      35       235465 :     return (s1[0] == s2[0]) && cmp_str3(s1+1,s2+1);
      36              :   }
      37              : 
      38       528298 :   inline bool cmp_str4n(const char * s1, const char s2[4]) {
      39       528298 :     return cmp_str3(s1,s2);
      40              :   }
      41              : 
      42        38961 :   inline bool cmp_str5(const char * s1, const char s2[6]) {
      43        38961 :     return cmp_str1(s1,s2) && cmp_str3(s1+2,s2+2);
      44              :   }
      45              : 
      46          944 :   inline bool cmp_str5n(const char * s1, const char s2[5]) {
      47          944 :     return cmp_str3(s1,s2) && (s1[4] == s2[4]);
      48              :   }
      49              : 
      50        77317 :   inline bool cmp_str6(const char * s1, const char s2[7]) {
      51        77317 :     return cmp_str3(s1,s2) && cmp_str2(s1+4,s2+4);
      52              :   }
      53              : 
      54         8732 :   inline bool cmp_str6n(const char * s1, const char s2[6]) {
      55         8732 :     return cmp_str3(s1,s2) && cmp_str1(s1+4,s2+4);
      56              :   }
      57              : 
      58       277017 :   inline bool cmp_str7(const char * s1, const char s2[8]) {
      59       277017 :     return (*(const int64_t *)s1 == *(const int64_t *)s2);
      60              :   }
      61              : 
      62            0 :   inline bool cmp_str7n(const char * s1, const char s2[8]) {
      63            0 :     return (cmp_str3(s1,s2) && cmp_str3n(s1+4,s2+4));
      64              :   }
      65              : 
      66         9990 :   inline bool cmp_str8(const char * s1, const char s2[9]) {
      67         9990 :     return cmp_str7(s1,s2) && (s1[8] == 0);
      68              :   }
      69              : 
      70            0 :   inline bool cmp_str8n(const char * s1, const char s2[9]) {
      71            0 :     return (*(const int64_t *)s1 == *(const int64_t *)s2);
      72              :   }
      73              : 
      74        24909 :   inline bool cmp_str9(const char * s1, const char s2[10]) {
      75        24909 :     return cmp_str1(s1,s2) && cmp_str7(s1+2,s2+2);
      76              :   }
      77              : 
      78        79252 :   inline bool cmp_str10(const char * s1, const char s2[11]) {
      79        79252 :     return cmp_str7(s1,s2) && cmp_str2(s1+8,s2+8);
      80              :   }
      81              : 
      82        82419 :   inline bool cmp_str11(const char * s1, const char s2[12]) {
      83        82419 :     return cmp_str7(s1,s2) && cmp_str3(s1+8,s2+8);
      84              :   }
      85              : 
      86        42299 :   inline bool cmp_str12(const char * s1, const char s2[13]) {
      87        42299 :     return cmp_str7(s1,s2) && cmp_str4(s1+8,s2+8);
      88              :   }
      89              : 
      90         1925 :   inline bool cmp_str13(const char * s1, const char s2[14]) {
      91         1925 :     return cmp_str7(s1,s2) && cmp_str5(s1+8,s2+8);
      92              :   }
      93              : 
      94        14276 :   inline bool cmp_str14(const char * s1, const char s2[14]) {
      95        14276 :     return cmp_str7(s1,s2) && cmp_str6(s1+8,s2+8);
      96              :   }
      97              : 
      98          849 :   inline bool cmp_str15(const char * s1, const char s2[16]) {
      99          849 :     return cmp_str7(s1,s2) && cmp_str7(s1+8,s2+8);
     100              :   }
     101              : 
     102         1415 :   inline bool cmp_str16(const char * s1, const char s2[17]) {
     103         1415 :     return cmp_str7(s1,s2) && cmp_str7(s1+8,s2+8) && (s1[16] == 0);
     104              :   }
     105              : 
     106              : } // namespace oks
     107              : } // namespace dunedaq
     108              : 
     109              : #endif
        

Generated by: LCOV version 2.0-1