
The article explores the development and optimizations of a tiny bitfield based text renderer capable of rendering with fewer bytes of x86 code, highlighting its efficiency, examples of bitfield packing for data compression, and its practical applications in intros.
Main Points
Initial non-bitfield x86 code
The author wrote specific x86 code which resulted in about 69 bytes to render a “ORZ” string with a custom tiny typeface. This initial implementation did not use bitfield but was a reference for evaluating generic algorithms later.
Optimized x86 conversion
A x86 handwritten conversion of the best C algorithm resulted in 52 bytes of x86 code, which is smaller than the first non-generic one, demonstrating competitiveness of handwritten optimizations.
Bitfields for data packing
Bitfields allow packing data compactly, with 9-bit required to encode a glyph in a 3x3 font, showcasing the method’s space efficiency.
Practical example in intro demo
A demo by Baudsurfer / RSI called Centurio, packed the logo in a single 32-bit value showcasing practical use of bitfields in intros.
Insights
A tiny bitfield based text renderer can achieve rendering using as little as 52 bytes of x86 code, achieving high data compression and efficiency.
I later did a x86 handwritten conversion of my best C algorithm, the result is 52 bytes of x86 code so far which is smaller than my first non generic one! I guess it was worth it.
Bitfields offer a compact way to pack and access text data for rendering, enabling significant space savings.
Packing data into a bit field (e.g., using bits as an array where a bit represent a glyph pixel) was quite mandatory to save space, 9-bit is required to encode a glyph since it is a 3x3 font so ones can just use a single 32-bit value to represent 3 glyph at a time.