Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Bitwise function(s) Question -- Again!
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00722339
Message ID:
00722381
Vues:
24
George,

Thanks for that clarification. That has helped the penny drop!

>>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.
-=Gary
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform