LCOV - code coverage report
Current view: top level - frmts/grib/degrib/g2clib - int_power.c (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 11 11 100.0 %
Date: 2024-05-06 18:28:20 Functions: 1 1 100.0 %

          Line data    Source code
       1             : #include "grib2.h"
       2             : /*
       3             :  * w. ebisuzaki
       4             :  *
       5             :  *  return x**y
       6             :  *
       7             :  *
       8             :  *  input: double x
       9             :  *         int y
      10             :  */
      11      129614 : double int_power(double x, g2int y) {
      12             : 
      13             :         double value;
      14             : 
      15      129614 :         if (y < 0) {
      16          45 :                 y = -y;
      17          45 :                 x = 1.0 / x;
      18             :         }
      19      129614 :         value = 1.0;
      20             : 
      21      445087 :         while (y) {
      22      315473 :                 if (y & 1) {
      23      192261 :                         value *= x;
      24             :                 }
      25      315473 :                 x = x * x;
      26      315473 :                 y >>= 1;
      27             :         }
      28      129614 :         return value;
      29             : }
      30             : 

Generated by: LCOV version 1.14