LCOV - code coverage report
Current view: top level - ballet/murmur3 - fd_murmur3.c (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 43 43 100.0 %
Date: 2025-01-08 12:08:44 Functions: 2 2 100.0 %

          Line data    Source code
       1             : #include "fd_murmur3.h"
       2             : 
       3             : static uint
       4             : fd_murmur3_32_( void const * _data,
       5             :                 ulong        sz,
       6   316974624 :                 uint         seed ) {
       7             : 
       8   316974624 :   uchar const * data   = _data;
       9   316974624 :   uint          sz_tag = (uint)sz;
      10             : 
      11   316974624 :   uint c1 = 0xcc9e2d51U;
      12   316974624 :   uint c2 = 0x1b873593U;
      13   316974624 :   int  r1 = 15;
      14   316974624 :   int  r2 = 13;
      15   316974624 :   uint m  = 5;
      16   316974624 :   uint n  = 0xe6546b64U;
      17             : 
      18   316974624 :   uint hash = seed;
      19             : 
      20  1737496608 :   while( sz>=4 ) {
      21  1420521984 :     uint k  = FD_LOAD( uint, data );
      22  1420521984 :          k *= c1;
      23  1420521984 :          k  = fd_uint_rotate_left( k, r1 );
      24  1420521984 :          k *= c2;
      25             : 
      26  1420521984 :     hash ^= k;
      27  1420521984 :     hash  = fd_uint_rotate_left( hash, r2 );
      28  1420521984 :     hash  = hash*m + n;
      29             : 
      30  1420521984 :     data+=4UL;
      31  1420521984 :     sz  -=4UL;
      32  1420521984 :   }
      33             : 
      34   316974624 :   uint rem = 0;
      35   316974624 :   switch( sz ) {
      36     3398997 :   case 3: rem ^= (uint)data[2]<<16U;  __attribute__((fallthrough));
      37     5486940 :   case 2: rem ^= (uint)data[1]<<8U;   __attribute__((fallthrough));
      38     7598796 :   case 1: rem ^= (uint)data[0];
      39     7598796 :           rem *= c1;
      40     7598796 :           rem  = fd_uint_rotate_left( rem, r1 );
      41     7598796 :           rem *= c2;
      42     7598796 :           hash ^= rem;                __attribute__((fallthrough));
      43   316974624 :   case 0: break;
      44   316974624 :   }
      45             : 
      46   316974624 :   hash ^= sz_tag;
      47   316974624 :   hash ^= hash>>16U;
      48   316974624 :   hash *= 0x85ebca6bU;
      49   316974624 :   hash ^= hash>>13U;
      50   316974624 :   hash *= 0xc2b2ae35U;
      51   316974624 :   hash ^= hash>>16U;
      52             : 
      53   316974624 :   return hash;
      54   316974624 : }
      55             : 
      56             : uint
      57             : fd_murmur3_32( void const * _data,
      58             :                ulong        sz,
      59   316974624 :                uint         seed ) {
      60   316974624 :   return fd_murmur3_32_( _data, sz, seed );
      61   316974624 : }

Generated by: LCOV version 1.14