File: compare256_c.c

package info (click to toggle)
node-yarnpkg 4.1.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 24,752 kB
  • sloc: javascript: 38,953; ansic: 26,035; cpp: 7,247; sh: 2,829; makefile: 724; perl: 493
file content (31 lines) | stat: -rw-r--r-- 899 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* compare256.c -- 256 byte memory comparison with match length return
 * Copyright (C) 2020 Nathan Moinvaziri
 * For conditions of distribution and use, see copyright notice in zlib.h
 */

#include "zbuild.h"
#include "compare256_p.h"

// Set optimal COMPARE256 function variant
#if OPTIMAL_CMP == 8
#  define COMPARE256          compare256_8
#elif defined(HAVE_BUILTIN_CTZLL)
#  define COMPARE256          compare256_64
#elif defined(HAVE_BUILTIN_CTZ)
#  define COMPARE256          compare256_32
#else
#  define COMPARE256          compare256_16
#endif

Z_INTERNAL uint32_t compare256_c(const uint8_t *src0, const uint8_t *src1) {
    return COMPARE256(src0, src1);
}

// Generate longest_match_c
#define LONGEST_MATCH       longest_match_c
#include "match_tpl.h"

// Generate longest_match_slow_c
#define LONGEST_MATCH_SLOW
#define LONGEST_MATCH       longest_match_slow_c
#include "match_tpl.h"