Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Bittest function
Message
 
 
To
14/09/2000 09:53:30
Jim Rieck
Quicken Loans/Rock Financial/Title Sourc
Livonia, Michigan, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00416338
Message ID:
00416348
Views:
20
>I am using the bittest function and getting a function, argument, type, or count is invalid. The code is bittest(bitmask,196608).
>
>What's wrong?
>
>Jim

Bittest() just tests a certain bit in the expression you pass and returns .T. if it is a 1 and .F. if it is a 0.

8 in binary is 100
? bittest(8,3) && returns .T.
? bittest(8,2) && returns .F.

The value 196608 is beyond the range of Bittest(). Maybe you want something like BitAnd(). It can be used to determine if a mask exists within a number.

? bitand(32,48) && returns 32

This means bitwise speaking that 32 is included in the make up of 48.
32 = 10000
48 = 11000
Ex.

if bitand(mask,196608) = mask then
   * do something because the mask is good
else
   * it's not included; do something else
endif
HTH.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Reply
Map
View

Click here to load this message in the networking platform