DELPHI盒子
!实时搜索: 盒子论坛 | 注册用户 | 修改信息 | 退出
检举帖 | 全文检索 | 关闭广告 | 捐赠
技术论坛
 用户名
 密  码
自动登陆(30天有效)
忘了密码
≡技术区≡
DELPHI技术
lazarus/fpc/Free Pascal
移动应用开发
Web应用开发
数据库专区
报表专区
网络通讯
开源项目
论坛精华贴
≡发布区≡
发布代码
发布控件
文档资料
经典工具
≡事务区≡
网站意见
盒子之家
招聘应聘
信息交换
论坛信息
最新加入: webb123
今日帖子: 3
在线用户: 2
导航: 论坛 -> DELPHI技术 斑竹:liumazi,sephil  
作者:
男 ycfree (ycfree) ★☆☆☆☆ -
盒子活跃会员
2021/2/28 16:08:13
标题:
求各位大神帮忙把这段汇编改成Delphi代码,万分感谢! 浏览:1413
加入我的收藏
楼主: 里面有两小段汇编,请各位大神帮忙,改成Delphi代码,感谢!!!

function TRepSparseList.ForAll(ApplyFunction: Pointer): integer;
var
  itemP: PAnsiChar;
  Item: Pointer;
  i, callerBP: Cardinal;
  j, Index: integer;
begin
  Result := 0;
  i := 0;
  
  asm
    mov   eax,[ebp]
    mov   callerBP,eax
  end;

  while (i < SlotsInDir) and (Result = 0) do
  begin
    itemP := SecDir^[i];
    if itemP <> nil then
    begin
      j := 0;
      index := i shl cnSecShift;
      while (j < cnSecSize) and (Result = 0) do
      begin
        Item := PPointer(itemP)^;
        if Item <> nil then
          asm
          mov   eax,index
          mov   edx,item
          push  callerBP
          call  ApplyFunction
          pop   ecx
          mov   @Result,eax
          end;

        Inc(itemP, SizeOf(Pointer));
        Inc(j);
        Inc(index);
      end;
    end;
    Inc(i);
  end;
end;
----------------------------------------------
-
作者:
男 ycfree (ycfree) ★☆☆☆☆ -
盒子活跃会员
2021/3/1 9:12:03
1楼: 都不会
还是
要收费
----------------------------------------------
-
作者:
男 datm (dATM) ★☆☆☆☆ -
盒子活跃会员
2021/3/1 10:38:40
2楼: Result := ApplyFunction(index,item);
----------------------------------------------
-
作者:
男 ycfree (ycfree) ★☆☆☆☆ -
盒子活跃会员
2021/4/12 8:55:12
3楼: 2楼能行?不行吧,各位大神继续帮帮忙啊
----------------------------------------------
-
作者:
男 2cc (2cc) ▲▲△△△ -
普通会员
2021/4/12 9:59:57
4楼: Result :=PInteger (ApplyFunction(index,item,callerBP))^;
----------------------------------------------
-
作者:
男 ycfree (ycfree) ★☆☆☆☆ -
盒子活跃会员
2021/4/12 10:31:01
5楼: 编译不过呀,兄弟们
----------------------------------------------
-
作者:
男 kaida (kaida) ★☆☆☆☆ -
盒子活跃会员
2021/4/13 16:05:44
6楼: 本身就是 Delphi 代码,有什么可改的?
跟汇编没有一毛钱关系。
你的 SlotsInDir, SecDir, cnSecShift, cnSecSize 在哪里定义?
----------------------------------------------
http://down.desei.com.cn/down/1041485/MyWeb/VCLs.html
作者:
男 2cc (2cc) ▲▲△△△ -
普通会员
2021/4/13 21:00:21
7楼: type
  TSPAApply = function(index: integer; item: pointer);

Function TRepSparseList.ForAll( ApplyFunction: Pointer {TSPAApply} ):Integer;
Var
  itemP: PPointer; 
  i: Cardinal;
  j, index: Integer;
Begin
  Result := 0;
  i := 0;
  While ( i < slotsInDir ) And ( Result = 0 ) Do
  Begin
    itemP := secDir^[i];
    If itemP <> Nil Then
    Begin
      j := 0;
      index := i Shl SecShift;
      While ( j < FSectionSize ) And ( Result = 0 ) Do
      Begin
        If itemP^ <> Nil Then
    begin
          result := TSPAApply(ApplyFunction)(index,itemP^.Ptr);
    end;  
        Inc( itemP );
        Inc( j );
        Inc( index )
      End
    End;
    Inc( i )
  End;
End;
----------------------------------------------
-
作者:
男 ycfree (ycfree) ★☆☆☆☆ -
盒子活跃会员
2021/4/14 16:09:21
8楼: 非常感谢各位提供思路,已搞定
----------------------------------------------
-
信息
登陆以后才能回复
Copyright © 2CCC.Com 盒子论坛 v3.0.1 版权所有 页面执行76.17188毫秒 RSS