flags |= 0x100;
if (!(flags & 0x100)) { ... }
Addition might factor in either as a substitution for bitwise-OR or bitwise-XOR where the author has prior knowledge that the two are equivalent (and assumes it will lead to better code generation), as part of SWAR (simd-within-a-word) code, or in cases where integer fields are packed alongside flags (e.g. a refcount and a couple of flags, or a string-length and some flags). 4501C0 add r8d,r8d
7503 jnz 0x8
41FFC0 inc r8d
(And, unlike the ARM code, you'd need an additional mov instruction if you wanted to preserve the input value.) cmp wzr, w19 // set the carry flag if w19 is zero
adc w8, w19, w19 // w8 = w19 + w19 + carry
If you still maintain this code and want to optimise it, I don't think you should need a full powers-of-two table, just having log(n) powers of two should do in a pattern like:
That's a straightforward memory saving and also leaves v normalised, so gives you your fraction bits with a single multiplication or division. This is a little less simple than I'm making it look, because in reality you end up moving v to near the subnormal range, or having to use a different code path if v < 1 vs if v >= 2 or something. But otherwise, yeah, the code looks good.