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
#!/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,
using import testing
# generate a new main executable
bin-dir := compiler-dir .. "/bin"
include-dir := compiler-dir .. "/include"
options "-I" include-dir
#!/usr/bin/env scopes
let stringtest = "Hello"
let booltest = true
import .tukan.glmain
import .tukan.screen
#import .tukan.imgui
let glmain = tukan.glmain
View gist:8de9fde641e0e3380e48d0010921e08b
# normal form
label success
let success? =
label skip
if (('typeof struct-fields) == Nothing)
merge skip
let field = ('getarg struct-fields i)
let field = (field as type)
let elem =
try ('@ field 'Default)
You can’t perform that action at this time.