logoalt Hacker News

gizmo686yesterday at 9:07 AM1 replyview on HN

X86-64 has the REP prefix for string operation. When combined with the MOVS instruction, that is pretty much an instruction for strcpy.


Replies

messeyesterday at 10:11 AM

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).

show 1 reply