View Full Version : bitwise operators
Ricod
12-06-2001, 04:34 PM
I'm so going to sound like a total rookie ...
Can somebody please tell me what good those bitwise operators are ?
I never know when to use "==" and when to use "eq". When do use "!=" and when "<>" ? Or "||". Don't they do the same ?
i always use ==,!= (<> is not for flash... that is vb,vbs,vba),'and', 'or' and 'not'.
but i guess that doesn't answer your question... i think 'eq' is a holdover from f4.
Ricod
12-06-2001, 05:52 PM
but tg, <> is in the help defined as numeric is not or something like that. Still, don't know what a bitwise operator is and what it does though ...:(
i have tried to use the '<>' inequality operator before, and couldn't get it to work, so just assumed that was my dumb ass vb background butting into my code and i moved over to the '!=' operator.*scratchin my head* that was when i was first learnin, so i must have done something else wrong.
talked to a buddy of mine here at work about 'bitwise' operators... its a bit over my head (sorry for the pun), but here is how it goes...
the bitwise operators take the expressions to be compared and breaks them down to the binary level and does a bit by bit comparison of the two expressions.
so looking at page 193 of the actionscript reference guide... bitwise OR (|):
it will take the two expressions break them down to binary and return a 1 for each bit position where either expression contains a 1.
(their example)
15 = 1111
9=1001
15 | 9 would come to 1111
because in all 4 positions for either number there was a 1.
i started reading throughsome of these, and i gotta say it is some freaky stuff.
Jesse
12-07-2001, 01:01 AM
never use <> or eq, always use != and ==, the others are just for backward compatibility. || and 'or' are interchangable but 'or' is easier to read.
Ricod
12-07-2001, 08:27 AM
Its a lot clearer now ! And'now I can totally ignore all bitwise operators since it'll probably never come in handy for me anyway !
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.