Autor Beitrag
pHaRyNx
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 94

win 95, win 2000, win xp, VISTA, Ubuntu 8.04
Delphi 7 PE
BeitragVerfasst: So 10.09.06 17:56 
hi!

ich versuche gerade mit dem bitoperator XOR zu arbeiten...folgendes beispiel:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
...
var x,y,z:Integer;
begin

x:=57;
y:=61;

z:=x xor y;

showmessage(IntToStr(z));

end;


als ergebnis bekomme ich heraus: z=4

so, nun aber in assembler der gleiche befehl und dort bekomme ich als resultat 54 heraus.

^^??? stimmt irgendetwas mit meinem quelltext nicht oder wieso sind die ergebnisse unterschiedlich ???

plz help.

mfg pHaRyNx
Martok
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 3661
Erhaltene Danke: 604

Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
BeitragVerfasst: So 10.09.06 18:04 
Wie sieht denn dein Assembler aus?

_________________
"The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."
Born-to-Frag
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1094

Win XP SP2, Win 2000 SP4
Delphi 7, 2k5
BeitragVerfasst: So 10.09.06 18:06 
user profile iconpHaRyNx hat folgendes geschrieben:
hi!

ich versuche gerade mit dem bitoperator XOR zu arbeiten...folgendes beispiel:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
...
var x,y,z:Integer;
begin

x:=57;
y:=61;

z:=x xor y;

showmessage(IntToStr(z));

end;


als ergebnis bekomme ich heraus: z=4

so, nun aber in assembler der gleiche befehl und dort bekomme ich als resultat 54 heraus.

^^??? stimmt irgendetwas mit meinem quelltext nicht oder wieso sind die ergebnisse unterschiedlich ???

plz help.

mfg pHaRyNx


4 sollte stimmen:

ausblenden Quelltext
1:
2:
3:
4:
111001 (x)
111101 (y)
------
000100


Wie sieht dein asm-code aus?

_________________
Theorie ist wenn man alles weiß, aber nichts funktioniert. Praxis ist wenn alles funktioniert, aber niemand weiß warum.
Microsoft vereint Theorie und Praxis: Nichts funktioniert und niemand weiß warum.
pHaRyNx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 94

win 95, win 2000, win xp, VISTA, Ubuntu 8.04
Delphi 7 PE
BeitragVerfasst: So 10.09.06 18:15 
XOR EDX,EBX
^^EDX und EBX enthalten die werte 57 bzw. 61
Tilo
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 1098
Erhaltene Danke: 13

Win7 geg. WInXP oder sogar Win98
Rad2007
BeitragVerfasst: Mo 11.09.06 07:31 
Wie sieht das Ergebnis im Assembler aus, wenn Du die Werte verstauscht?
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: Mo 11.09.06 10:45 
Wie ich das immer liebe, wenn der code nicht vollständig ist...
Aber zum Glück kann ich mich immer gut in die Leute hineinversetzen, du hast in Assembler statt 61 und 57 die hexwerte $61 und $57 genommen dann kommt dezimal 54 raus.

_________________
wer andern eine grube gräbt hat ein grubengrabgerät
- oder einfach zu viel zeit
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: Mo 11.09.06 17:10 
Mal ganz davon abgesehen, dass das EBX-Register für Anfänger tabu sein sollte ...
EAX, EDX und ECX ja, aber EBX NIEMALS!!!

Ansonsten schließ ich mich uall an ;-)

_________________
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.