On 9 Oct 00, at 15:22, Ben Lowndes wrote:
> Can anyone recommend a place to learn more aobut the BitWise math functions,
Bit operations simply compare two values and return a result of the logical
comparison, bit-by-bit. For example, let's use bitwise operations on the
values 1010 and 1100 (10 and 12, for the decimal-minded among us).
Bitwise AND says to return 1 if BOTH values have a 1 in that position, so
result of ANDing these two values would be:
1010
AND 1100
----
1000 (8, for the decimal heads)
Bitwise OR says to return 1 if EITHER value has a 1 in that position, so
the result of ORing these two values would be:
1010
OR 1100
----
1110 (14, for the DHs)
ORing two values is like saying "if either value has a bit set, then set that
bit for the result". Naturally, this makes it great for setting flags (bits)
without disturbing other bits. For example, let's say we have a flag for
AdminUser with a value of 1. If we OR this value with either of our test
values, we get a result that includes the bits set in the original value, plus
the bit set in the AdminUser value. So:
1010 1100
OR 0001 OR 0001
---- ----
1011 1101
Most boolean operations can be applied to values in a bitwise fashion, such as
XOR (exclusive or), NAND (not AND), and so on. I don't have my CF reference at
hand, so I can't tell you exhaustively how many of these are implemented by CF
Bitwise functions. AND and OR are by far the most frequently used, however.
Bitheads Unite!
- Jeff
==============================================================
| Jeffrey S. Peters | "Specialization is for insects." |
| [EMAIL PROTECTED] | - Lazarus Long |
==============================================================
------------------------------------------------------------------------------
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/fusebox or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.