compat.xxhash
#includeExtremely 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
openkal
| target | result | environment | test project | first diagnostic |
|---|---|---|---|---|
| x86_64-linux-gnu | runs | posix | xxhash | |
| x86_64-windows-musl | runs | posix | xxhash |
How this was measured
Measured 2026-09-23 by tests/openkal/compat.py with openkal-llvm-runtime 0.15.1, llvm@22.1.8, mcpp 2026.9.21.3. The test project selects no platform dependency of its own. The badge above is a summary of the strictest measured target -- the table above states each target's own environment.
Build
- targets
xxhash (lib)- language
c++23- C standard
c11- import std
- no
- include dirs
*
Sources (1)
*/xxhash.c