Leonard Ritter · @lritter
2284 followers · 6236 posts · Server mastodon.gamedev.place

implementing a feature of Swift in less than 20 lines of code

#scopes

Last updated 1 year ago

Leonard Ritter · @lritter
2277 followers · 6141 posts · Server mastodon.gamedev.place

global initializers can now be hooked, allowing garbage collected types to register their own roots

#scopes

Last updated 1 year ago

Leonard Ritter · @lritter
2275 followers · 6119 posts · Server mastodon.gamedev.place

when the toll is paid, many algorithms on top become trivial ²

#scopes #uheap

Last updated 1 year ago

Leonard Ritter · @lritter
2275 followers · 6119 posts · Server mastodon.gamedev.place

when the toll is paid, many algorithms on top become trivial

#scopes #uheap

Last updated 1 year ago

Leonard Ritter · @lritter
2273 followers · 5988 posts · Server mastodon.gamedev.place

this was a fun nerd snipe: traverse an arbitrary range in the fewest number of log2 sized _and_ log2-aligned steps.

while this solution works, i feel there's possibly an even simpler one. the descend from the largest log2 aligned offset is basically just the remaining bits of the number. but the ascend is trickier.

#scopes

Last updated 1 year ago

Leonard Ritter · @lritter
2274 followers · 5985 posts · Server mastodon.gamedev.place

integrated auto-capturing into the existing capture module, and it should be relatively robust now and compatible to existing captures.

#scopes

Last updated 1 year ago

Leonard Ritter · @lritter
2279 followers · 5960 posts · Server mastodon.gamedev.place

wrote a lazy sum type generator / dispatcher, similar to our existing switcher pattern.

#scopes

Last updated 1 year ago

Leonard Ritter · @lritter
2278 followers · 5915 posts · Server mastodon.gamedev.place
Leonard Ritter · @lritter
2278 followers · 5882 posts · Server mastodon.gamedev.place

a bit of sugar later we've got transactions that can be rolled back.

#scopes

Last updated 1 year ago

Leonard Ritter · @lritter
2278 followers · 5868 posts · Server mastodon.gamedev.place

phew. with a precomputed table, it is possible to compute the rolling hash of an arbitrarily big buffer of a repeating byte in log time. i'm sure this can be extended to arbitrary repetition of string, but this was hard enough.

#scopes

Last updated 1 year ago

Leonard Ritter · @lritter
2278 followers · 5812 posts · Server mastodon.gamedev.place

work of yesterday: devise content addressable 128-bit hash that allows subslicing and concatenation without knowing what the actual content is.

i used a byte-wise polynomial rolling hash which does a reversible splitmix128 as finalizer to improve avalanche effect. for concat and slice the inverse splitmix128 is used to recover the rolling hash value.

#scopes

Last updated 1 year ago

Leonard Ritter · @lritter
2274 followers · 5781 posts · Server mastodon.gamedev.place

a bunch of hygienic macros reduce webgpu chained struct inits to nothing.

#scopes

Last updated 1 year ago

Leonard Ritter · @lritter
2268 followers · 5768 posts · Server mastodon.gamedev.place

future-proof initialization of don't-care webgpu limits in

#scopes

Last updated 1 year ago

Leonard Ritter · @lritter
2261 followers · 5723 posts · Server mastodon.gamedev.place

settled on this syntax to discern mutable from immutable (memoized) types in the token db.

if you make an immutable type and declare all members mutable you've effectively made a singleton.

#scopes

Last updated 1 year ago

Leonard Ritter · @lritter
2261 followers · 5715 posts · Server mastodon.gamedev.place

added support for a `then` block for `try` so exception handling is closer to destructuring.

#scopes

Last updated 1 year ago

Leonard Ritter · @lritter
2260 followers · 5704 posts · Server mastodon.gamedev.place

first success in building a nice little ORM for the token db in ; i can transparently switch out structs for these and they will just work.

#scopes

Last updated 1 year ago

Leonard Ritter · @lritter
2261 followers · 5696 posts · Server mastodon.gamedev.place

no one can stop me now

#scopes

Last updated 1 year ago

Leonard Ritter · @lritter
2253 followers · 5620 posts · Server mastodon.gamedev.place

in my experience with so far, a function f(map, value) -> {map, value} is universal enough to translate/expand/compile any kind of data efficiently. `map` can be shared by multiple different contexts but must be immutable to allow isolating subscopes, and universally polymorphic, so that any kind of key can be mapped to any kind of value, and so that it can also hold submaps. likewise `value` must be a universal variant.

#scopes

Last updated 1 year ago

Leonard Ritter · @lritter
2246 followers · 5591 posts · Server mastodon.gamedev.place

wrote a BNF-like metagenerator in in 130 lines; 160 lines more for a matcher implementation, and 100 lines for a synthesizer (produce random specimens from the rules).

the demo below implements a small procedural fantasy word generator that is fed into the matcher for validation and segmentation.

#scopes

Last updated 1 year ago

Leonard Ritter · @lritter
2204 followers · 5542 posts · Server mastodon.gamedev.place

can convert C include files to declarations in a scope object, and it can now also print scope objects into executable text form, which means that with a bunch of lines, one can now directly generate offline bindings from C header files

#scopes

Last updated 1 year ago