from Hacker News

Show HN: Bitmask.h a 300-byte C99 library for embedded bit operations

by DenisDolya on 1/4/26, 11:54 AM with 0 comments

After years of wrestling with verbose bit-twiddling code in embedded projects, I created bitmask.h to solve a simple problem: most bit manipulation libraries are either too heavy (STL-style), too platform-specific (compiler intrinsics), or require writing the same error-prone bit operations repeatedly. This single-header C99 library packs all essential operations—bit set/clear/check, range operations, popcount, iteration—into ~300 bytes of machine code with zero allocations. It's what I needed for microcontroller work where every byte counts, using only C99 and manual optimizations to remain completely portable.

GitHub: https://github.com/Ferki-git-creator/Bitmask