Re:Six times faster than C
by gpderetta on Friday July 07, 2023 @08:01AM
(#36630390)
If I read it correctly, your implementation might read beyond the end of the buffer, and if it crosses a page boundary into an unmapped page, it will segfault. That's one of the many evils of null terminated strings.
[ Parent
| on HN ]
If we go by the absolute strictest interpretation of the C standard, yes, the above is UB.
But in practice no one has page boundaries that cross word boundaries, and I align to a word boundary before doing the word-by-word loop.