LCOV - code coverage report
Current view: top level - src - math.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 30 30 100.0 %
Date: 2020-09-22 18:03:19 Functions: 7 7 100.0 %

          Line data    Source code
       1             : // System Includes
       2             : #include <limits.h>
       3             : 
       4             : // Internal Includes
       5             : #include "kirke/math.h"
       6             : 
       7           3 : long math__min__long( long first, long second ){
       8           3 :     if( first < second ){
       9           1 :         return first;
      10             :     }
      11             : 
      12           2 :     return second;
      13             : }
      14             : 
      15           3 : long math__max__long( long first, long second ){
      16           3 :     if( first > second ){
      17           1 :         return first;
      18             :     }
      19             : 
      20           2 :     return second;
      21             : }
      22             : 
      23           3 : unsigned long math__min__ulong( unsigned long first, unsigned long second ){
      24           3 :     if( first < second ){
      25           1 :         return first;
      26             :     }
      27             : 
      28           2 :     return second;
      29             : }
      30             : 
      31           3 : unsigned long math__max__ulong( unsigned long first, unsigned long second ){
      32           3 :     if( first > second ){
      33           1 :         return first;
      34             :     }
      35             : 
      36           2 :     return second;
      37             : }
      38             : 
      39          43 : unsigned long long math__min__ullong( unsigned long long first, unsigned long long second ){
      40          43 :     if( first < second ){
      41          39 :         return first;
      42             :     }
      43             : 
      44           4 :     return second;
      45             : }
      46             : 
      47          33 : unsigned long long math__max__ullong( unsigned long long first, unsigned long long second ){
      48          33 :     if( first > second ){
      49          21 :         return first;
      50             :     }
      51             : 
      52          12 :     return second;
      53             : }
      54             : 
      55          49 : unsigned long math__nearest_greater_power_of_2__ulong( unsigned long value ){
      56          49 :     if( value == 0 ){
      57           1 :         return 1;
      58             :     }
      59             : 
      60          74 :         while( value & ( value - 1 ) ){
      61          26 :                 value = value & ( value - 1 );
      62             :     }
      63             : 
      64          48 :         return value << 1;
      65             : }

Generated by: LCOV version 1.15