Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BitTest'ing numbers larger then 32 bits
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01677684
Message ID:
01677696
Views:
65
Likes (1)
>>>Happy New Year all,
>>>
>>>I have run into a wall. I have a argument that is a set of bit flags. Currently, I have hit the 32 bit integer limit using the VFP bit functions of 32 bit. Now I am looking for a means to extend this to more flags (bits) without having to do a large rewrite in my system. The question is, is there a known UDF function that mimics the BITTEST (and possible other bit-wise functions) that can deal with numbers larger then 32 bits?
>>
>>The only thing that comes to mind is to somehow keep this larger integer as a binary string, and then bittest the asc() of the relevant byte in it.
>
>Thanks. I have consider that approach, but it would call for a lot of rewrite in the several application that use the my UDF feature.
>
>I seem to recall that someone mentioned they used something like the Currency data type to overcome the 32bit issue. But I seem not to find that solution. Now, I can store a value as a number that is greater the 2^31, but the FoxPro BIT-wise functions are limited to the 32 bit integer. I am hoping that maybe a FLL or DLL exists that can process possibly 63 bit numbers bit-wise.
>
>And the search goes on...

Hi,

You can write special UDF for 64 bit numbers and call if you need it.
LOCAL m.lnX, m.lii
m.lnX=0xFFFFFFFF+1

FOR m.lii=1 TO 32
?m.lii, VFP64_BITTEST(m.lnX, m.lii)
NEXT
RETURN

PROCEDURE VFP64_BITTEST
LPARAMETERS m.nNumericExpression1, m.nBitNumber
RETURN IIF(m.nBitNumber<=31, BITTEST(m.nNumericExpression1, m.nBitNumber), BITTEST(m.nNumericExpression1/(0x100000000), m.nBitNumber-32))
RETURN 
.

MartinaJ
"Navision is evil that needs to be erazed... to the ground"

Jabber: gorila@dione.zcu.cz
Jabber? Jabbim
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform