Metaflame's Workshop

Random stuff I find interesting; Rust, Blender, personal thoughts, and so on.

A realization about float rounding modes

A realization about float rounding modes

Recently, I've been working on a RISC-V software implementation as a personal project. I have most of the basics working, and right now I'm adding support for floating point operations. Because I wanted the code to be fully portable, and I didn't want to dig into inline assembly to directly control rounding modes, exception flags, and so on, I decided to make a full software implementation of floats (plus, hey, it's great practice too!)

Metaflame

System log snapshot - "I am alone in my system"

System log snapshot - "I am alone in my system"

A few months ago, I had written a short piece of prose. I kept it private, only sharing it with a few close friends, but I wanted to post it online now, too.

Metaflame

Self-referential Data across Functions

Self-referential Data across Functions

Self-referential structs are infamously painful to implement, and, besides something like an arena allocator, are impossible without messy or unsafe code. Awkward data structure juggling to satisfy the borrow checker, redundant runtime checks to delay borrow checking, lots of unwraps and pinky promises, or outright unsafe code that can be a pain to validate - it's usually just much better to rethink your data structures.

Metaflame
1

Unique generic type instantiation

Unique generic type instantiation

Abusing unnameable function types

Metaflame