[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
lAnd( <K_MASK>, <nValue> ) -> <lIsBit>
------------------------------------------------------------------------------
PARAMETER:
<K_MASK> Is Constant value where all bits to be tested are set to
TRUE
<nValue> Is Target value that will be tested
RETURNS:
<lIsBit> will be TRUE if the result is non-zero, which means that at
least one set Bit of <K_MASK> was also set in <nValue>
DESCRIPTION:
This function lets you perform a logical AND with an integer bitmask and
an integer value. The purpose is to test if one or more bits in <nValue>
are set ( TRUE ).
To do so, you have to provide a 'mask', which is normally a CONSTANT value
where the appropriate bits are set to TRUE. Windows ( and FiveWin therefore )
has a lot of binary Mask's ( known as the 'magic numbers' )
Storing informations in BITS is very economic, as you can store 8 logical
values in one Byte. Compare that to clippers logical, where you need
14 bytes just to store one state !
EXAMPLE:
Lets say you want to know if Bit 4 is set in the byte nKeyFlag
nKeyFlag 12 Binary 00001100
MASK 8 00001000
------------------------------------
12 AND 8 = 8 00001000
which will return a TRUE, as the result of the logical AND is non-zero
SOURCE:
SOURCE\FUNCTION\OR.C
See Also:
nAnd
nOr
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson