About Docs Source
LCOV - code coverage report
Current view: top level - include/crater - vec_check.h (source / functions) Hit Total Coverage
Test: unnamed Lines: 15 16 93.8 %
Date: 2024-02-13 04:57:17 Functions: 2 2 100.0 %

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include <crater/vec.h>
       4             : 
       5       12594 : inline static bool cr8r_vec_check_partition(const cr8r_vec *self, const cr8r_vec_ft *ft, uint64_t a, uint64_t b, const void *piv){
       6       12594 :     const void *fst = self->buf + a*ft->base.size;
       7       12594 :     const void *lst = self->buf + (b - 1)*ft->base.size;
       8       12594 :     if(a >= b || b > self->len || piv < fst || piv > lst){
       9           0 :         return false;
      10             :     }
      11     1753564 :     for(const void *it = fst; it < piv; it += ft->base.size){
      12     1740970 :         if(ft->cmp(&ft->base, it, piv) >= 0){
      13             :             return false;
      14             :         }
      15             :     }
      16     1760971 :     for(const void *it = piv; it <= lst; it += ft->base.size){
      17     1748377 :         if(ft->cmp(&ft->base, it, piv) < 0){
      18             :             return false;
      19             :         }
      20             :     }
      21             :     return true;
      22             : }
      23             : 
      24        5000 : inline static bool cr8r_vec_check_pwm(cr8r_vec_ft *ft, cr8r_vec *self, uint64_t a, uint64_t lb, uint64_t ha, uint64_t b, void *med){
      25       25222 :     for(uint64_t i = a; i < lb; ++i){
      26       20222 :         if(ft->cmp(&ft->base, self->buf + i*ft->base.size, med) >= 0){
      27             :             return false;
      28             :         }
      29             :     }
      30       10047 :     for(uint64_t i = lb; i < ha; ++i){
      31        5047 :         if(ft->cmp(&ft->base, self->buf + i*ft->base.size, med)){
      32             :             return false;
      33             :         }
      34             :     }
      35       24666 :     for(uint64_t i = ha; i < b; ++i){
      36       19666 :         if(ft->cmp(&ft->base, self->buf + i*ft->base.size, med) <= 0){
      37             :             return false;
      38             :         }
      39             :     }
      40             :     return true;
      41             : }
      42             : 

Generated by: LCOV version 1.14