源码是用置入代码来实现的。
' mov eax,dword [ebp+08h] ' mov eax,dword [eax] ' cmp eax,0 ' je exit ' push edx ' push edi ' lea edx,dword [eax+03h] ' label_b: ' mov edi,dword [eax] ' add eax,4 ' lea ecx,dword [edi-01010101h] ' not edi ' and ecx,edi ' and ecx,80808080h ' jnz nxt ' mov edi,dword [eax] ' add eax,4 ' lea ecx,dword [edi-01010101h] ' not edi ' and ecx,edi ' and ecx,80808080h ' jz label_b ' nxt: ' test ecx,00008080h ' jnz label_f ' shr ecx,16 ' add eax,2 ' label_f: ' shl cl,1 ' sbb eax,edx ' pop edi ' pop edx ' exit: ' leave ' ret 04h
汇编strlen
mov edi, [eax] add eax, 4 lea ecx, [edi-1010101h] not edi and ecx, edi and e
用汇编语言实现strlen