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.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Value

Value

Photo of Bit

Bit

Photo of middle

middle

Related news:

News photo

Nintendo's secret Mario & Luigi: Brothership developer is a bit of a surprise

News photo

Altman-Backed Nuclear Stock Doubles in Value on AI Power Demand

News photo

Saudi Tech Firm Ejada Taps Goldman for IPO at $1.5 Billion Value