Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
BitAnd() limitation?
Message
De
06/08/2004 18:59:40
 
 
À
06/08/2004 17:28:17
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00931430
Message ID:
00931473
Vues:
23
>>hello everybody.
>>
>>it seems, in Vfp6 Sp5, that the following works:
>>
>>?bitand(2^30, 2^30) = 2^30 && shows .t.
>>but the next one does not
>>?bitand(2^31, 2^31) = 2^31 && shows .f.
>>
>>is this the limitation of BitAnd()?
>>
>>if so, is there a workaround? currently i need to be able to check for values up to 2^33
>>
>>thanks for all your help in advance!
>
>Definitely a limitation on BITAND and the other bit functions. They can only work on 32 bit numbers, but it seems it won't work on the 32nd bit as that's the sign bit. The help doesn't even mention 32 bits, but I think that's the case.
>
>Some of the bit commands mention bits 0-31 and some don't. Also, I don't think you're using BITAND correctly, it returns the bits that are common to the parameters you pass, not a .T./.F. return value.
>
>?TRANSFORM(BITAND(2^31,2^31),"@0x")
>
>prints a value of 0x80000000, which is correct.


hello Fred

thanks for your response. the Transform() solution might work, i'll have to check that tomorow. i am using this not to find the common bit, but to allow for different options in my program, something simular to the messagebox function with the different options.
3 Yes, No, and Cancel buttons 
16 Stop sign 
256 Second button 

BitAnd(3+16+256, 3) = 3   && this must be the yes/no....
BitAnd(3+16+256, 16) = 16   && this must be the stop sign
BitAnd(3+16+256, 256) = 256   && this must be the second button
i then can find which, multible, options where choosen. i have 33 options at this time (they might be more in the future). actually this is not a user function i have, but a program which i need to be flexible enough to be able to change at any time.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform