| ▲ | messe 3 hours ago | |
No, it's an instruction for memcpy. You still need to compute the string length first, which means touching every byte individually because you can't use SIMD due to alignment assumptions (or lack thereof) and the potential to touch uninitialized or unmapped memory (when the string crosses a page boundary). | ||
| ▲ | ncruces 2 hours ago | parent [-] | |
You do aligned reads, which can't crash. Not even musl uses a scalar loop, if it can do aligned reads/writes: https://git.musl-libc.org/cgit/musl/tree/src/string/stpcpy.c And you don't need to worry about C UB if you do it in ASM. | ||