Coverage Report

Created: 2026-02-14 07:07

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/zlib-ng/crc32.c
Line
Count
Source
1
/* crc32.c -- compute the CRC-32 of a data stream
2
 * Copyright (C) 1995-2022 Mark Adler
3
 * For conditions of distribution and use, see copyright notice in zlib.h
4
 *
5
 * This interleaved implementation of a CRC makes use of pipelined multiple
6
 * arithmetic-logic units, commonly found in modern CPU cores. It is due to
7
 * Kadatch and Jenkins (2010). See doc/crc-doc.1.0.pdf in this distribution.
8
 */
9
10
#include "zbuild.h"
11
#include "functable.h"
12
#include "crc32_braid_tbl.h"
13
14
/* ========================================================================= */
15
16
0
const uint32_t * Z_EXPORT PREFIX(get_crc_table)(void) {
17
0
    return (const uint32_t *)crc_table;
18
0
}
19
20
#ifdef ZLIB_COMPAT
21
unsigned long Z_EXPORT PREFIX(crc32_z)(unsigned long crc, const unsigned char *buf, size_t len) {
22
    if (buf == NULL)
23
        return CRC32_INITIAL_VALUE;
24
    return (unsigned long)FUNCTABLE_CALL(crc32)((uint32_t)crc, buf, len);
25
}
26
#else
27
4.24M
uint32_t Z_EXPORT PREFIX(crc32_z)(uint32_t crc, const unsigned char *buf, size_t len) {
28
4.24M
    if (buf == NULL)
29
0
        return CRC32_INITIAL_VALUE;
30
4.24M
    return FUNCTABLE_CALL(crc32)(crc, buf, len);
31
4.24M
}
32
#endif
33
34
#ifdef ZLIB_COMPAT
35
unsigned long Z_EXPORT PREFIX(crc32)(unsigned long crc, const unsigned char *buf, unsigned int len) {
36
    if (buf == NULL)
37
        return CRC32_INITIAL_VALUE;
38
    return (unsigned long)FUNCTABLE_CALL(crc32)((uint32_t)crc, buf, len);
39
}
40
#else
41
12.0k
uint32_t Z_EXPORT PREFIX(crc32)(uint32_t crc, const unsigned char *buf, uint32_t len) {
42
12.0k
    if (buf == NULL)
43
624
        return CRC32_INITIAL_VALUE;
44
11.4k
    return FUNCTABLE_CALL(crc32)(crc, buf, len);
45
12.0k
}
46
#endif