小编Pro*_*ala的帖子

rep stosb指令如何比等效循环执行得更快?

指令如何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而不是手动编写循环?

optimization performance x86 assembly micro-optimization

13
推荐指数
2
解决办法
6251
查看次数