有段C语言的代码,要是转换成Delphi的请教怎么写?(100分)

  • 主题发起人 HongYuan
  • 开始时间
H

HongYuan

Unregistered / Unconfirmed
GUEST, unregistred user!
test = ~test;
temp[0] = *((char*)&test+0);
temp[1] = *((char*)&test+1);
temp[2] = *((char*)&test+2);
temp[3] = *((char*)&test+3);
test1 = (float*)temp;
ph = *test1;
 
连变量声明都省了 靠
type
PSingle = ^Single;
var
test:Integer;
temp:array [0..3] of Byte;
test1:pSingle;
ph:Single;
begin
test:=not test;
temp[0]:=PByte(Integer(@test))^;
temp[1]:=PByte(Integer(@test)+1)^;
temp[2]:=PByte(Integer(@test)+2)^;
temp[3]:=PByte(Integer(@test)+3)^;
test1:=PSingle(@temp[0]);
ph:=test1^

end;
 
呵呵 好心人挺多的 顶
 
test := not test;
test := PSingle(@test)^;

原来没有这么复杂呀,直接取反,然后转换一下类型就成了
 
多人接受答案了。
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
1K
DelphiTeacher的专栏
D
I
回复
0
查看
600
import
I
I
回复
0
查看
512
import
I
顶部