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

https://news.ycombinator.com/item?id=46487113
by DenisDolya • 7 months ago
2 0 7 months ago

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

Related Stories

Loading related stories...

Source preview

news.ycombinator.com