delphi StrLenWide 汇编统计字符串长度


本文整理自网络,侵删。

 
function StrLenWide(const Str: PWideChar): Cardinal;
asm
  {Check the first byte}
  cmp word ptr [eax], 0
  je @ZeroLength
  {Get the negative of the string start in edx}
  mov edx, eax
  neg edx
@ScanLoop:
  mov cx, [eax]
  add eax, 2
  test cx, cx
  jnz @ScanLoop
  lea eax, [eax + edx - 2]
  shr eax, 1
  ret
@ZeroLength:
  xor eax, eax
end;

相关阅读 >>

Delphi mscomm1自动获取串口

Delphi android实例-退出程序(xe8+小米2)

Delphi 判断一个颜色是否是亮色

Delphi下用cdo发送邮箱实例(授权码cdo发送邮箱的解决办法)

Delphi cef4Delphi 浏览器事件

Delphi mscomm简单的中间pc串口数据中转

Delphi winapi: getdesktopwindow - 返回桌面窗口的句柄

Delphi2010中使用pchar时e2010 incompatible types: 'char' and 'ansichar' 错误的处理

Delphi双击tmemo选择光标所在行

Delphi winapi: flashwindow - 闪烁窗口

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...