Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
BitAnd() limitation?
Message
De
12/08/2004 10:55:46
 
 
À
12/08/2004 05:55:56
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00931430
Message ID:
00932734
Vues:
12
Thanks for your help Fabio, but it does not work either. if i check against a testbit=32 or 33 it returns .f.
* *** the following returns .f. (not correct, should be .t.)
?Test(;
	2^1 + ;
	2^2 + ;
	2^3 + ;
	2^4 + ;
	2^5 + ;
	2^6 + ;
	2^7 + ;
	2^8 + ;
	2^9 + ;
	2^10 + ;
	2^11 + ;
	2^12 + ;
	2^13 + ;
	2^14 + ;
	2^15 + ;
	2^16 + ;
	2^17 + ;
	2^18 + ;
	2^19 + ;
	2^20 + ;
	2^21 + ;
	2^22 + ;
	2^23 + ;
	2^24 + ;
	2^25 + ;
	2^26 + ;
	2^27 + ;
	2^28 + ;
	2^29 + ;
	2^30 + ;
	2^31 + ;
	2^32 + ;
	2^33, ;
	32)
the 2^2 in the original post was a typo, sorry about that.


>Because you write a bad number :
>
>....
>	2^2 + ;
>	2^2 + ;
>....
>
>
>This generate a carry bit that change the number's bits pattern.
>
>
>Use the next, it is more faster,simple and sure:
>
>clear
>* *** the following returns .t. (correct)
>?Test(;
>	2^1 + ;
>	2^2 + ;
>	2^3 + ;
>	2^4 + ;
>	2^5 + ;
>	2^6 + ;
>	2^7 + ;
>	2^8 + ;
>	2^9 + ;
>	2^10 + ;
>	2^11 + ;
>	2^12 + ;
>	2^13 + ;
>	2^14 + ;
>	2^15 + ;
>	2^16 + ;
>	2^17 + ;
>	2^18 + ;
>	2^19 + ;
>	2^20 + ;
>	2^21 + ;
>	2^22 + ;
>	2^23 + ;
>	2^24 + ;
>	2^25 + ;
>	2^26 + ;
>	2^27 + ;
>	2^28 + ;
>	2^29 + ;
>	2^33, ;
>	2)
>
>* *** the following returns .t. (correct)
>?Test(;
>	2^1 + ;
>	2^2 + ;
>	2^3 + ;
>	2^4 + ;
>	2^5 + ;
>	2^6 + ;
>	2^7 + ;
>	2^8 + ;
>	2^9 + ;
>	2^10 + ;
>	2^11 + ;
>	2^12 + ;
>	2^13 + ;
>	2^14 + ;
>	2^15 + ;
>	2^16 + ;
>	2^17 + ;
>	2^18 + ;
>	2^19 + ;
>	2^20 + ;
>	2^21 + ;
>	2^22 + ;
>	2^23 + ;
>	2^24 + ;
>	2^25 + ;
>	2^26 + ;
>	2^27 + ;
>	2^28 + ;
>	2^29 + ;
>	2^30 + ;
>	2^31 + ;
>	2^32 + ;
>	2^33, ;
>	31)
>
>FUNCTION Test
>LPARA	MasterBit, TestBit
>
>RETURN BITTEST(m.MasterBit*2^MIN(0,32*SIGN(31-m.TestBit)), m.TestBit%32)
>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform