Skip to content

Instantly share code, notes, and snippets.

View cgiosy's full-sized avatar

cgiosy cgiosy

View GitHub Profile
@cgiosy
cgiosy / xxh32.js
Last active June 29, 2022 23:16
XXHash32 JS Implementation
const getUint32 = (arr: Uint8Array, i: number) => (
arr[i] | arr[i + 1 | 0] << 8 | arr[i + 2 | 0] << 16 | arr[i + 3 | 0] << 24
);
const rotl32 = (x: number, r: number) => (x << r) | (x >>> 32 - r);
const xxh32 = (buf: Uint8Array, seed = 0) => {
seed |= 0;
const len = buf.length | 0;
let i = 0;
@cgiosy
cgiosy / bench.cpp
Last active January 17, 2024 20:06
#define LOAD_FACTOR 0.5
#include "robin-hood.hpp"
#define ERASE_TECHNIQUE USE_SHIFTING
#include "robin-hood.hpp"
#include "random.hpp"
#include "lib/bytell_hash_map.hpp"
#define LOOKUP_ZIPF true
#include <cmath>
#include <cstdint>
@cgiosy
cgiosy / dlas.hpp
Last active January 21, 2025 04:49
Diversified Late Acceptance Search
#ifndef DLAS_HPP
#include "intdef.hpp"
#include <array>
#include <algorithm>
#include <functional>
#include <utility>
template<class T, class U>
T incMod(T x, U mod) {