Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Bitwise function(s) Question -- Again!
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00722339
Message ID:
00722373
Views:
24
>Hiya George:
>
>>Use BITXOR()
>
? BITXOR(nFlags, 8)
>
>I already tried BITXOR which returns the correct value the first time. However, if you run it again, you get back to 10 (relative to the stated example). Any more thoughts?
>

Gary,

The following code snippet might help
* nFlags = 8 or 2
IF BITAND(nFlags, 8) # 0
  * Clear it
  nFlags = BITXOR(nFlags, 8)
ELSE
  * Set it
  nFlags = BITOR(nFlags, 8)
ENDIF
You can also use BITTEST() to check if a particular bit is set. In this case, ? BITTEXT(nFlags, 3) (because 8 = 2 ^ 3) will tell you whether or not (.T. or .F.) it's set.
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform