Skip to content

Instantly share code, notes, and snippets.

Leonard Ritter paniq

  • Duangle GbR
Block or report user

Report or block paniq

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:453ea55a0c56b3d3247cc81d79ab1e3f
using import struct
typedef FILE
FILE* = (mutable pointer FILE)
View gist:bea06b8d194a494e4d5b5bce0a953949
using import ..tukan.libc
using import ..tukan.ode
using import ..tukan.sdl
let world = (dWorldCreate)
assert (world != null)
implicit cube-to-simplex subdivision
fn cube-simplex (pred)
""""ivec3 ivec3 ivec3 ivec3 <- ivec3
for three coordinate predicates
r: y <= z, g: z < x, b: x < y
return the two defining vertices of the simplex that the coordinate is in
and the four planes required for computing barycentric coordinates
the resulting simplex has the corners (0 0 0) v1 v2 (1 1 1)
#!/usr/bin/env scopes
using import glm
using import glsl
using import itertools
using import
using import ..tukan.bitmap
using import ..tukan.random
using import .testfragment
View number_parser.cpp
struct NumberParser {
enum {
NPF_Sign = (1 << 0),
NPF_Negative = (1 << 1),
NPF_Base = (1 << 2),
NPF_Dot = (1 << 3),
NPF_Exponent = (1 << 4),
NPF_ExponentSign = (1 << 5),
NPF_ExponentNegative = (1 << 6),
NPF_Inf = (1 << 7),
View gist:b7bb72b5bd1a910ffcf5e4bb16bb29af
inline gen-include-options! (name)
print "gen-include-options!" name
let modules... =
using import enum
enum UTF8
# an invalid state was encountered
Invalid : i8
# a codepoint has been read successfully
Codepoint : u32
# declare i8 @llvm.ctlz.i8 (i8 <src>, i1 <is_zero_undef>)
let llvm.ctlz.i8 =
# implementation of
using import Array
let IdIndexT = u32
let GenT = u32
# must be at least 1

Twisting Pool Queue

by Leonard Ritter, 2019-05-12

An implementation written in Scopes can be found here

We have the task of distributing IDs to objects in a pool that we can use to look up their contents. We want to ensure that:

  • Insert, access, and remove are operations with O(1) complexity.
  • The object array is compact, i.e. without any gaps, so we can parallelize work on it with full occupancy.
paniq /
Last active May 11, 2019
Twisting Pool Allocator (Scopes)
""""Twisting Pool Allocator
written by Leonard Ritter (
ported and expanded from the C version (
This file is in the public domain
I don't know if I was the first one to stumble upon this technique, so
I can't guarantee there's no patent on it, but let's hope there's not,
You can’t perform that action at this time.