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-07-12 15:23:06 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       482430 :   inline bool cmp_str1(const char * s1, const char s2[2]) {
      15       482430 :     return (*(const int16_t *)s1 == *(const int16_t *)s2);
      16              :   }
      17              : 
      18        47209 :   inline bool cmp_str2(const char * s1, const char s2[3]) {
      19        47209 :     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       817233 :   inline bool cmp_str3(const char * s1, const char s2[4]) {
      27       817233 :     return (*(const int32_t *)s1 == *(const int32_t *)s2);
      28              :   }
      29              : 
      30       133102 :   inline bool cmp_str3n(const char * s1, const char s2[3]) {
      31       133102 :     return (s1[0] == s2[0]) && cmp_str1(s1+1,s2+1);
      32              :   }
      33              : 
      34       235224 :   inline bool cmp_str4(const char * s1, const char s2[5]) {
      35       235224 :     return (s1[0] == s2[0]) && cmp_str3(s1+1,s2+1);
      36              :   }
      37              : 
      38       528300 :   inline bool cmp_str4n(const char * s1, const char s2[4]) {
      39       528300 :     return cmp_str3(s1,s2);
      40              :   }
      41              : 
      42        38896 :   inline bool cmp_str5(const char * s1, const char s2[6]) {
      43        38896 :     return cmp_str1(s1,s2) && cmp_str3(s1+2,s2+2);
      44              :   }
      45              : 
      46          936 :   inline bool cmp_str5n(const char * s1, const char s2[5]) {
      47          936 :     return cmp_str3(s1,s2) && (s1[4] == s2[4]);
      48              :   }
      49              : 
      50        77229 :   inline bool cmp_str6(const char * s1, const char s2[7]) {
      51        77229 :     return cmp_str3(s1,s2) && cmp_str2(s1+4,s2+4);
      52              :   }
      53              : 
      54         8724 :   inline bool cmp_str6n(const char * s1, const char s2[6]) {
      55         8724 :     return cmp_str3(s1,s2) && cmp_str1(s1+4,s2+4);
      56              :   }
      57              : 
      58       276737 :   inline bool cmp_str7(const char * s1, const char s2[8]) {
      59       276737 :     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        24885 :   inline bool cmp_str9(const char * s1, const char s2[10]) {
      75        24885 :     return cmp_str1(s1,s2) && cmp_str7(s1+2,s2+2);
      76              :   }
      77              : 
      78        79172 :   inline bool cmp_str10(const char * s1, const char s2[11]) {
      79        79172 :     return cmp_str7(s1,s2) && cmp_str2(s1+8,s2+8);
      80              :   }
      81              : 
      82        82291 :   inline bool cmp_str11(const char * s1, const char s2[12]) {
      83        82291 :     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        14228 :   inline bool cmp_str14(const char * s1, const char s2[14]) {
      95        14228 :     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