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: 2025-12-21 13:07:08 Functions: 91.3 % 23 21

            Line data    Source code
       1              : #ifndef OKS_CSTRING_CMP_H
       2              : #define OKS_CSTRING_CMP_H
       3              : 
       4              : #include <stdint.h>
       5              : 
       6              : namespace dunedaq {
       7              : namespace oks {
       8              : 
       9       415813 :   inline bool cmp_str1(const char * s1, const char s2[2]) {
      10       415813 :     return (*(const int16_t *)s1 == *(const int16_t *)s2);
      11              :   }
      12              : 
      13        40414 :   inline bool cmp_str2(const char * s1, const char s2[3]) {
      14        40414 :     return cmp_str1(s1,s2) && (s1[2] == 0);
      15              :   }
      16              : 
      17        25406 :   inline bool cmp_str2n(const char * s1, const char s2[2]) {
      18        25406 :     return cmp_str1(s1,s2);
      19              :   }
      20              : 
      21       723988 :   inline bool cmp_str3(const char * s1, const char s2[4]) {
      22       723988 :     return (*(const int32_t *)s1 == *(const int32_t *)s2);
      23              :   }
      24              : 
      25       115654 :   inline bool cmp_str3n(const char * s1, const char s2[3]) {
      26       115654 :     return (s1[0] == s2[0]) && cmp_str1(s1+1,s2+1);
      27              :   }
      28              : 
      29       201720 :   inline bool cmp_str4(const char * s1, const char s2[5]) {
      30       201720 :     return (s1[0] == s2[0]) && cmp_str3(s1+1,s2+1);
      31              :   }
      32              : 
      33       475658 :   inline bool cmp_str4n(const char * s1, const char s2[4]) {
      34       475658 :     return cmp_str3(s1,s2);
      35              :   }
      36              : 
      37        33021 :   inline bool cmp_str5(const char * s1, const char s2[6]) {
      38        33021 :     return cmp_str1(s1,s2) && cmp_str3(s1+2,s2+2);
      39              :   }
      40              : 
      41          766 :   inline bool cmp_str5n(const char * s1, const char s2[5]) {
      42          766 :     return cmp_str3(s1,s2) && (s1[4] == s2[4]);
      43              :   }
      44              : 
      45        65729 :   inline bool cmp_str6(const char * s1, const char s2[7]) {
      46        65729 :     return cmp_str3(s1,s2) && cmp_str2(s1+4,s2+4);
      47              :   }
      48              : 
      49         7906 :   inline bool cmp_str6n(const char * s1, const char s2[6]) {
      50         7906 :     return cmp_str3(s1,s2) && cmp_str1(s1+4,s2+4);
      51              :   }
      52              : 
      53       236655 :   inline bool cmp_str7(const char * s1, const char s2[8]) {
      54       236655 :     return (*(const int64_t *)s1 == *(const int64_t *)s2);
      55              :   }
      56              : 
      57            0 :   inline bool cmp_str7n(const char * s1, const char s2[8]) {
      58            0 :     return (cmp_str3(s1,s2) && cmp_str3n(s1+4,s2+4));
      59              :   }
      60              : 
      61         8605 :   inline bool cmp_str8(const char * s1, const char s2[9]) {
      62         8605 :     return cmp_str7(s1,s2) && (s1[8] == 0);
      63              :   }
      64              : 
      65            0 :   inline bool cmp_str8n(const char * s1, const char s2[9]) {
      66            0 :     return (*(const int64_t *)s1 == *(const int64_t *)s2);
      67              :   }
      68              : 
      69        21176 :   inline bool cmp_str9(const char * s1, const char s2[10]) {
      70        21176 :     return cmp_str1(s1,s2) && cmp_str7(s1+2,s2+2);
      71              :   }
      72              : 
      73        67753 :   inline bool cmp_str10(const char * s1, const char s2[11]) {
      74        67753 :     return cmp_str7(s1,s2) && cmp_str2(s1+8,s2+8);
      75              :   }
      76              : 
      77        70124 :   inline bool cmp_str11(const char * s1, const char s2[12]) {
      78        70124 :     return cmp_str7(s1,s2) && cmp_str3(s1+8,s2+8);
      79              :   }
      80              : 
      81        36407 :   inline bool cmp_str12(const char * s1, const char s2[13]) {
      82        36407 :     return cmp_str7(s1,s2) && cmp_str4(s1+8,s2+8);
      83              :   }
      84              : 
      85         1750 :   inline bool cmp_str13(const char * s1, const char s2[14]) {
      86         1750 :     return cmp_str7(s1,s2) && cmp_str5(s1+8,s2+8);
      87              :   }
      88              : 
      89        11701 :   inline bool cmp_str14(const char * s1, const char s2[14]) {
      90        11701 :     return cmp_str7(s1,s2) && cmp_str6(s1+8,s2+8);
      91              :   }
      92              : 
      93          768 :   inline bool cmp_str15(const char * s1, const char s2[16]) {
      94          768 :     return cmp_str7(s1,s2) && cmp_str7(s1+8,s2+8);
      95              :   }
      96              : 
      97         1280 :   inline bool cmp_str16(const char * s1, const char s2[17]) {
      98         1280 :     return cmp_str7(s1,s2) && cmp_str7(s1+8,s2+8) && (s1[16] == 0);
      99              :   }
     100              : 
     101              : } // namespace oks
     102              : } // namespace dunedaq
     103              : 
     104              : #endif
        

Generated by: LCOV version 2.0-1