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: 2026-10-22 18:10:43 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      826642 :                 uint         seed ) {
       7             : 
       8      826642 :   uchar const * data   = _data;
       9      826642 :   uint          sz_tag = (uint)sz;
      10             : 
      11      826642 :   uint c1 = 0xcc9e2d51U;
      12      826642 :   uint c2 = 0x1b873593U;
      13      826642 :   int  r1 = 15;
      14      826642 :   int  r2 = 13;
      15      826642 :   uint m  = 5;
      16      826642 :   uint n  = 0xe6546b64U;
      17             : 
      18      826642 :   uint hash = seed;
      19             : 
      20     3887091 :   while( sz>=4 ) {
      21     3060449 :     uint k  = FD_LOAD( uint, data );
      22     3060449 :          k *= c1;
      23     3060449 :          k  = fd_uint_rotate_left( k, r1 );
      24     3060449 :          k *= c2;
      25             : 
      26     3060449 :     hash ^= k;
      27     3060449 :     hash  = fd_uint_rotate_left( hash, r2 );
      28     3060449 :     hash  = hash*m + n;
      29             : 
      30     3060449 :     data+=4UL;
      31     3060449 :     sz  -=4UL;
      32     3060449 :   }
      33             : 
      34      826642 :   uint rem = 0;
      35      826642 :   switch( sz ) {
      36      195655 :   case 3: rem ^= (uint)data[2]<<16U;  __attribute__((fallthrough));
      37      368839 :   case 2: rem ^= (uint)data[1]<<8U;   __attribute__((fallthrough));
      38      626627 :   case 1: rem ^= (uint)data[0];
      39      626627 :           rem *= c1;
      40      626627 :           rem  = fd_uint_rotate_left( rem, r1 );
      41      626627 :           rem *= c2;
      42      626627 :           hash ^= rem;                __attribute__((fallthrough));
      43      834298 :   case 0: break;
      44      826642 :   }
      45             : 
      46      826306 :   hash ^= sz_tag;
      47      826306 :   hash ^= hash>>16U;
      48      826306 :   hash *= 0x85ebca6bU;
      49      826306 :   hash ^= hash>>13U;
      50      826306 :   hash *= 0xc2b2ae35U;
      51      826306 :   hash ^= hash>>16U;
      52             : 
      53      826306 :   return hash;
      54      826642 : }
      55             : 
      56             : uint
      57             : fd_murmur3_32( void const * _data,
      58             :                ulong        sz,
      59      826703 :                uint         seed ) {
      60      826703 :   return fd_murmur3_32_( _data, sz, seed );
      61      826703 : }

Generated by: LCOV version 1.14