facil.io

#facil.io STL — Core

#The C Server Toolbox Library

Welcome to the heart of the facil.io C STL. This is where the boring-but-essential stuff lives: version numbers, compiler incantations, OS patches, atomics, memory primitives, and the low-level helpers that everything else builds on. It is not glamorous, but without it the rest of the library would be a pile of undefined behavior and segfaults.

The core group covers the first two slices of the library — 000 core.h and 001 header.h — plus their specialized sidekicks. Each file below is a focused guide to one corner of that foundation.

#Core documentation index

  • 001 version and settings — Version macros and the compile-time knobs that tune the library's behavior.
  • 001 compiler attributes — Compiler detection, C/C++ attribute helpers, and pointer-math macros.
  • 001 os detection — POSIX/Windows detection, process helpers, and portable type patches.
  • 001 atomics and locks — Atomic operations, spinlocks, atomic bitmap access, and thread-yield hints.
  • 001 static alloc — The round-robin scratch allocator for short-lived temporary buffers.
  • 001 logging — Log levels, assertion macros, and the leak counter.
  • 001 endian — Byte-order detection, swaps, and conversions between host and network/little-endian layouts.
  • 001 memory primitives — Low-level copy/move/compare helpers and unaligned buffer accessors.
  • 001 memalt — Portable fallback memory routines and the environment helpers they lean on.
  • 001 vector math — Wide integer unions from 128 to 4096 bits and their lane-wise arithmetic.
  • 001 simd — Fake/portable x86 intrinsics and SIMD helpers built on the wide vector types.
  • 001 linked lists — Pointer-based and indexed linked-list macros.
  • 001 constant time — Branchless selection, bitwise comparisons, and other security-sensitive primitives.
  • 001 bit operations — Rotations, popcount, bitmap access, and byte-value bit tricks.
  • 001 math — Hash primes, modular arithmetic, and multi-precision add/sub/mul helpers.
  • 001 random core — The deterministic 128-bit PRNG and its reseeding/cycle-counter hooks.
  • 001 string info — Lightweight string and buffer descriptors plus equality helpers.
  • 001 utf8 — Encoding, decoding, and validation helpers for UTF-8 text.

Everything after the core builds on these pages. Pick a topic and dig in.