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 bluenoise.sc
#!/usr/bin/env scopes
using import glm
using import glsl
using import itertools
using import ..tukan.gl
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... =
'app
'gfx
'time
'audio
'args
View utf8_decoder.sc
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 =
View twisting_pool_queue.sc
# implementation of
https://gist.github.com/paniq/856241af5d8a69a76a5b7e941b2533f0
using import Array
let IdIndexT = u32
let GenT = u32
# must be at least 1
View twistpool.md

Twisting Pool Queue

by Leonard Ritter leonard.ritter@duangle.com, 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
paniq / twistpool.sc
Last active May 11, 2019
Twisting Pool Allocator (Scopes)
View twistpool.sc
""""Twisting Pool Allocator
=======================
written by Leonard Ritter (leonard.ritter@duangle.com)
ported and expanded from the C version (https://gist.github.com/paniq/d867c6b5ea9c68a352a1)
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,
View makemain.sc
using import testing
# generate a new main executable
bin-dir := compiler-dir .. "/bin"
include-dir := compiler-dir .. "/include"
include
options "-I" include-dir
View liveui.sc
#!/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.