LCOV - code coverage report
Current view: top level - src/include/storage - checksum_block_internal.h Coverage Total Hit
Test: PostgreSQL 19devel Lines: 100.0 % 11 11
Test Date: 2026-04-07 14:16:30 Functions: - 0 0
Legend: Lines:     hit not hit

            Line data    Source code
       1              : /*-------------------------------------------------------------------------
       2              :  *
       3              :  * checksum_block_internal.h
       4              :  *    Core algorithm for page checksums, semi-private to checksum_impl.h
       5              :  *    and checksum.c.
       6              :  *
       7              :  * Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
       8              :  * Portions Copyright (c) 1994, Regents of the University of California
       9              :  *
      10              :  * src/include/storage/checksum_block_internal.h
      11              :  *
      12              :  *-------------------------------------------------------------------------
      13              :  */
      14              : 
      15              : /* there is deliberately not an #ifndef CHECKSUM_BLOCK_INTERNAL_H here */
      16              : 
      17              : uint32      sums[N_SUMS];
      18      2661751 : uint32      result = 0;
      19              : uint32      i,
      20              :             j;
      21              : 
      22              : /* ensure that the size is compatible with the algorithm */
      23              : Assert(sizeof(PGChecksummablePage) == BLCKSZ);
      24              : 
      25              : /* initialize partial checksums to their corresponding offsets */
      26      2661751 : memcpy(sums, checksumBaseOffsets, sizeof(checksumBaseOffsets));
      27              : 
      28              : /* main checksum calculation */
      29    173013815 : for (i = 0; i < (uint32) (BLCKSZ / (sizeof(uint32) * N_SUMS)); i++)
      30   5621618112 :     for (j = 0; j < N_SUMS; j++)
      31   5451266048 :         CHECKSUM_COMP(sums[j], page->data[i][j]);
      32              : 
      33              : /* finally add in two rounds of zeroes for additional mixing */
      34      7985253 : for (i = 0; i < 2; i++)
      35    175675566 :     for (j = 0; j < N_SUMS; j++)
      36    170352064 :         CHECKSUM_COMP(sums[j], 0);
      37              : 
      38              : /* xor fold partial checksums together */
      39     87837783 : for (i = 0; i < N_SUMS; i++)
      40     85176032 :     result ^= sums[i];
      41              : 
      42      2661751 : return result;
        

Generated by: LCOV version 2.0-1