C++ 字符串比较 汇编代码实现

2019-06-23  本文已影响0人  成都老刘

前言

导入很久很久以前写的一篇技术!缅怀下以前写 C++ 的日子

正文

int asmCmp(char* str1, char*str2){
    _asm{
        mov eax, str1
            mov ebx, str2
s1:
        mov cl, [ebx]
        cmp [eax], cl
            jne ret2
            cmp cl, 0
            je ret1
            add eax, 1
            add ebx, 1
            jmp s1
ret1:
        mov eax, 0
            jmp end1;
ret2:
        mov eax, 1      //这里可能不同的编译器需要不同的代码
end1:
    }
}
上一篇下一篇

猜你喜欢

热点阅读