mcpp index

compat.xxhash

#include

Extremely fast non-cryptographic hash algorithm (XXH32/XXH64/XXH3)

#include <xxhash.h>
mcpp add compat.xxhash@0.8.3

Usage

From this repository's own test project — built and run by CI, not written for the website.

// Behavioral test: the digests themselves, against upstream's own vectors.
//
// A hash package that links but computes a different value is worse than one
// that does not link at all — every caller downstream is content-addressing
// something. So the assertions here are known-answer tests taken verbatim from
// xxHash's `tests/sanity_test_vectors.h`, together with the buffer generator
// from `tests/sanity_test.c` that those vectors were computed over. Nothing is
// derived from running the code under test.
//
// The lengths cover every size branch XXH3 switches on (0, 1-3, 4-8, 9-16,
// 17-128, 129-240, >240) plus the multi-block path at 2048 and 4160, which is
// where a mis-selected SIMD variant or a byte-order slip would show up.
#include <xxhash.h>

#include <cassert>
#include <cstddef>
#include <cstdint>
#include <vector>

namespace {

// tests/sanity_test.c: fillTestBuffer(). "Its values must not be changed."
// …

tests/examples/xxhash/tests/digest.cpp · project tests/examples/xxhash

Build

targets
xxhash (lib)
language
c++23
C standard
c11
import std
no
include dirs
*

Sources (1)

  • */xxhash.c

Versions

VersionPlatforms Mirrorssha256
0.8.3 latest LinuxWindowsmacOS GLOBAL CN aae608dfe821…