Skip to content

Instantly share code, notes, and snippets.

View techgeek1's full-sized avatar

Austin Rife techgeek1

View GitHub Profile
@techgeek1
techgeek1 / thunk.rs
Created April 26, 2019 20:09
A lazily evaluated value store
use std::cell::Cell;
/// A thunk used for lazy generation and caching of values
struct Thunk<T: Copy> {
/// Cached value stored in the thunk
value: Cell<Option<T>>,
/// Generator function to generate a missing value
generator: fn() -> T
}
/// AVX implementation of the Harley-Seal algorithm for counting the number of bits in a bitset
///
/// # Safety
/// Assumes that the input is `BITSET_SIZE_IN_WORDS` in length
pub unsafe fn cardinality(bitset: &[u64]) -> usize {
debug_assert!(bitset.len() == BITSET_SIZE_IN_WORDS);
let d = bitset.as_ptr() as *const Register;
@techgeek1
techgeek1 / techgeek1-links.md
Last active February 25, 2026 16:57
Resources for game and engine dev I've found while building Eden
@techgeek1
techgeek1 / endeavour-os.sh
Last active August 1, 2025 20:38
Configuration script for my Endeavour OS systems.
#!/bin/bash
# --- Packages ---
# NOTE: I've noticed some issues where installs may fail if rapidly queued, to prevent this
# an artificial delay is inserted since this seems to make the behavior much more
# predictable
# Some operations seem to fail if time is not given for the system to do some kind of
# processing under the hood, so we insert artificial delays to help the process along