Get the latest tech news
Inserting a 0 bit in the middle of a value
This one originally came up for me in Oodle Texture’s BC7 decoder. In the BC7 format, each pixel within a 4×4 block can choose from a limited set of between 4 to 16 colors (ignoring some…
Some pixels are “anchors” which (for reasons outside the scope of this post) are forced to have the MSB of their color index be 0. The end result makes for some rather hairy-looking index arithmetic in the spec a few paragraphs above table 114. This works fine, there’s nothing wrong with it, it’s not a bottleneck or anything, but it bothered me just how much of a production it was for what seemed like a simple operation.
Or read this on Hacker News