Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Bitwise function(s) Question -- Again!
Message
From
14/11/2002 10:16:22
 
 
To
14/11/2002 04:43:36
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00722339
Message ID:
00722679
Views:
38
You're welcome, now you know what you are doing when you set a TCP/IP subnet mask. eg. 255.255.255.0 = 0xffffff00

>Albert:
>
>Thanks for a brilliant and enlightening explanation. It is truly appreciated!
>
>Best
>
>>>
>>>>bitand(nFlags, bitxor(nReset, 0xffffffff))
>>>
>>>
>>>Albert,
>>>
>>>What is the significance of "0xffffffff" ? Sorry to be thick. Could you explain the logic of the above if you have the time?
>>>
>>>Thanks.
>>
>>All VFP bitwise operations are done on 32 bit unsigned integers.
>>0xfffffff is the hexadecimal representation of a 32 bit unsigned integer with all bits set.
>>
>>XORing 0xfffffff with any value returns a Mask, by resetting the bits that represent the value. eg.
>>
>>Hex.
>>0xfffffff XOR
>>0x00000008 =
>>0xfffffff7
>>
>>Bin.
>>11111111111111111111111111111111 XOR
>>00000000000000000000000000001000 =
>>11111111111111111111111111110111
>>
>>Dec.
>>4294967295 XOR
>>0000000008 =
>>4294967287
>>
>>ANDing the Mask with a value returns a value that has been filtered through the mask.
>>
>> eg.
>>Hex.
>>0xfffffff7 AND
>>0x0000000a =
>>0x00000002
>>
>>Bin.
>>11111111111111111111111111110111 AND
>>00000000000000000000000000001010 =
>>00000000000000000000000000000010
>>
>>Dec.
>>4294967287 AND
>>0000000010 =
>>0000000002
>>
>>Remember that 0xffffffff is 4294967295 in 32 bit unsigned integers, VFP normally treats integers as signed. 0xffffffff is -1 in 32 bit signed integers. because of this
bitand(nFlags, bitxor(nReset, -1))
will also work.
Previous
Reply
Map
View

Click here to load this message in the networking platform