Autor Beitrag
uall@ogc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1826
Erhaltene Danke: 11

Win 2000 & VMware
Delphi 3 Prof, Delphi 7 Prof
BeitragVerfasst: So 23.01.05 22:57 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
function swapbytes(c: cardinal): cardinal; cdecl;
asm
  MOV ECX,DWORD PTR SS:[c]
  MOV EAX,ECX
  MOV EDX,ECX
  SAR EAX,$8
  AND EDX,$FF
  AND EAX,$FF
  SHL EDX,$8
  ADD EAX,EDX
  MOV EDX,ECX
  SAR EDX,$10
  SHL EAX,$8
  AND EDX,$FF
  ADD EAX,EDX
  SAR ECX,$18
  SHL EAX,$8
  AND ECX,$FF
  ADD EAX,ECX
end;


wiekann ich das in delphi lösen

bytes tauschen bei 4 bytes

aus $12345678 soll $78563412 werden

wenns mit ner assemböer anweisung in weniger zeilen geht oder es nen delphi code gibt plz posten es kann ruhig langsamer sein
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: So 23.01.05 23:24 
ausblenden Delphi-Quelltext
1:
Result := A and $FF shl 24 + A and $FF00 shl 8 + A and $FF0000 shr 8 + A and $FF000000 shr 24;					

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
tommie-lie
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 4373

Ubuntu 7.10 "Gutsy Gibbon"

BeitragVerfasst: So 23.01.05 23:27 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
function SwapLong(aValue: LongWord): LongWord; assembler
asm
  BSWAP EAX;
end;
oder
ausblenden Delphi-Quelltext
1:
2:
3:
4:
function SwapLong(aValue: LongWord): LongWord;
begin
  Result := ((aValue shr 24and $FFor ((aValue shr 8and $FF00or ((aValue shl 8and $FF0000or ((aValue shl 24and $FF000000);
end;

_________________
Your computer is designed to become slower and more unreliable over time, so you have to upgrade. But if you'd like some false hope, I can tell you how to defragment your disk. - Dilbert
uall@ogc Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1826
Erhaltene Danke: 11

Win 2000 & VMware
Delphi 3 Prof, Delphi 7 Prof
BeitragVerfasst: So 23.01.05 23:35 
danke euch beiden BSWAP hab ich genommen ist schön kurz :)