Tag: #optimization
Quickly checking for a zero byte in C using bitwise operations
How to check if a 64-bit word contains a zero byte. A step-by-step example and a proof of correctness. 2017-01-24
How can I do modulo with a bitmask in C?
Use
i & (n-1)
to compute i % n
, when n
is a power of two. This avoids the modulo operation. 2016-12-10What does the
restrict
keyword mean in C? The
restrict
keyword in C is a type qualifier that indicates a pointer parameter points to an object not accessed through any other pointer in the function’s scope. This allows the compiler to make optimizations. 2016-12-03All content copyright James Fisher.