Autor Beitrag
Aya
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1964
Erhaltene Danke: 15

MacOSX 10.6.7
Xcode / C++
BeitragVerfasst: Di 22.03.05 00:44 
Hi,

kann mir jemadn sagen wie ich in Delphi Bitweise vergleichen kann???

Also, wie sieht dieses C-Beispiel:

ausblenden Quelltext
1:
2:
int X;
bool bla = X & 0x80;


in Delphi aus???

Au'revoir,
Aya~

_________________
Aya
I aim for my endless dreams and I know they will come true!
delfiphan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2684
Erhaltene Danke: 32



BeitragVerfasst: Di 22.03.05 00:53 
Meinste du nicht eher
ausblenden Quelltext
1:
2:
int X;  
int bla = X & 0x80;

Mit and, in deinem Fall also X and $80.

(P.S. Power-Member kennt das AND nicht?)
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Di 22.03.05 00:56 
hmm mein c compiler führt das hier schon aus
ausblenden Quelltext
1:
2:
3:
int X;
X = 1;
bool bla = X & 0x80;
nur ist bla immer false (zumindest mit den zahlen wo ich rumgespielt hab)
aber AND entsprioht doch eigentlich && in C++
was ist dann & ?

_________________
es gibt leute, die sind genetisch nicht zum programmieren geschaffen.
in der regel haben diese leute die regel...
delfiphan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2684
Erhaltene Danke: 32



BeitragVerfasst: Di 22.03.05 00:59 
:arrow: "bool bla = X & 0x80;" entspricht in Delphi "boolean(X and $80)" bzw. "X and $80 <> 0".
"and" ist & und && gleichzeitig.
//Edit: Darstellung


Zuletzt bearbeitet von delfiphan am Di 22.03.05 01:01, insgesamt 1-mal bearbeitet
MagicAndre1981
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Di 22.03.05 01:00 
In C++ gilt folgendes:
& = Bitweises UND
&& = logisches UND.

André