RSSAmplifier

Blog

JoshJers' Ramblings

Infrequently-updated blog about software development, game development, and music

drilian.comRSS feed ↗10 posts

Latest posts

Protecting Coders From Ourselves: Better Mutex Protection

At some point, if you’ve done multithreaded programming, you’ve probably used a mutex (or some other locking mechanism) . Locks are relatively straightforward to understand and use (“lock this thing before accessing your data and unlock it when you’re done”), but they do have their issues. The most commonly-discussed issue with using locks is the dreaded deadlock , scourge of many a poor soul who…

Protecting Coders From Ourselves: Min, Max, Lerp, and Clamp

Imagine this: you’ve got some value, x , that you want to ensure is at least 1 . That is to say, you want to ensure its minimum value is 1 . So, being the smart, experienced programmer that you are, you write the following: x = Min ( x , 1 ) ; You give yourself the small, satisfied nod of a job well done and run the program and then it all goes immediately sideways because that should have been…

Parser Stuff: Strings

A while back I was working on a programming language idea and while I haven’t made any progress on it in ages, I really liked the string design that I came up with. I don’t know that any of the ideas are original, but I haven’t seen anything exactly like it so I figure I’d throw the idea out into the ether in case anyone else happens to do something similar in their own personal language that they…

Emulating the FMAdd Instruction, Part 2: 64-bit Floats

(This post follows Part 1: 32-bit floats and will make very little sense without having read that one first. Honestly, it might make little sense having read that one first, I dunno!) Last time we went over how to calculate the results of the FMAdd instruction (a fused-multiply-add calculated as if it had infinite internal precision) for 32-bit single -precision float values: Calculate the…

Emulating the FMAdd Instruction, Part 1: 32-bit Floats

A thing that I had to do at work is write an emulation of the FMAdd (fused multiply-add) instruction for hardware where it wasn’t natively supported (specifically I was writing a SIMD implementation, but the idea is the same), and so I thought I’d share a little bit about how FMAdd works, since I’ve already been posting about how float rounding works . So, screw it, here we go with another…

C++17-Style Hex Floats (And How To Parse Them)

C++17 added support for hex float literals, so you can put more bit-accurate floating point values into your code. They’re handy to have, and I wanted to be able to parse them from a text file in a C# app I was writing. Some examples: 0x1.0p0 // == 1.0 0x1.8p1 // == 3 0x8.0p-3 // == 1.0 0x0.8p1 // == 1.0 0xAB.CDEFp-10 // == 0.16777776181697846 0x0.0000000ABp0 // == 2.4883775040507317E-09 What Am I…

Wordpress No More

I’ve ported the blog off of Wordpress onto a static site generator (Specifically, 11ty/Eleventy ). I have a bit more control over the format here, and it’s easier for me to write pages (Wordpress was fighting me on all sorts of formatting which I can just do now). What this means is I can finally start copying over the rest of my posts that were on (the now-defunct, sadly) cohost.org (rest easy,…

Floating Point Numbers and Rounding

I was writing about how to parse C++17-style hex floating point literals, and in doing so I ended up writing a bunch about how floats work in general (and specifically how floating point rounding happens), so I opted to split it off from that post into its own, since it’s already probably way too many words as it is? Here we go! How Floats Work sign exponent mantissa 0 f e+f If you don’t know, a…

Resurrected

A while back (over a year ago) this blog got hacked and so it’s been down for a hot minute. I’ve brought it back online and now I can finally post things on it again – I have a few things that I’ll post here and there but honestly it’s unlikely to ever be really FREQUENT around here. But for now, it’s back!

Procyon is Greenlit!

Valve recently announced that Procyon is in the most-recent batch of titles to be given the green light for release on Steam ! This is super-exciting news! There are a few things that I want to add to Procyon before it’s ready for general Steam release: achievements, proper leaderboards, steam overlay support, etc. Basically, all of the steam features that make sense. It’ll be a bit before it gets…