Re:A 100LOC C impl of memset, that is faster than glibc's
by dahfizz on Friday November 12, 2021 @06:09PM
(#29205577)
Yeah, dealing with the smaller buffers is annoying. You could put buffers < 16 bytes in a separate codepath, but that's trading elegance for pretty minor gains.
We can't easily use a larger size because we mustn't read beyond the end of the buffer if it's shorter than 16 bytes and not a multiple of 2, 4, etc.