Hacker News new | ask | show | jobs
by ladberg 980 days ago
I've used this before for memcpy with arbitrary values that are likely to be one of a small set of known small sizes.

Calling memcpy with an arbitrary value always has to call out to libc but a specific value can be inlined into a single instruction or two for smaller values, so you can have an if-else chain or switch with a few common ones for your program and it's a noticeable speedup.