指令如何rep stosb
比这段代码执行得更快?
Clear: mov byte [edi],AL ; Write the value in AL to memory
inc edi ; Bump EDI to next byte in the buffer
dec ecx ; Decrement ECX by one position
jnz Clear ; And loop again until ECX is 0
Run Code Online (Sandbox Code Playgroud)
在所有现代CPU上都能保证这一点吗?我是否应该总是喜欢使用rep stosb
而不是手动编写循环?