[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
nAnd( nValue1, nValue2, ...nValueN )-> <nResult>
------------------------------------------------------------------------------
PARAMETER:
<nValue1> Is a ( long ) numerical mask value to be ANDed bitwise with
other long values
<nValue2..n > More long values to be ANDded
RETURNS:
<nResult> is the result of all given and bitwise ANDded values
DESCRIPTION:
nAnd() performs a bitwise AND on every given numeric argument. This is
neccessary if you want to generate a combinded value from different
constants, like it is done for Windows's magic style numbers.
Lets assume that you have coded a control of which its behaviour can be
set via numeric constants:
Constant Binary Decimal
C_VISIBLE 0001 1
C_OWNER 0010 2
C_ACTIVE 0100 4
C_MASK 0111 7
Just a little remembering: only 1 AND 1 = 1, all other combinations,
like 1 AND 0, 0 AND 1, 0 AND 0 will be zero ! So, to generate the style
value, just nAnd() all values with a given mask constant, where all the
bits are set high ( C_MASK ):
+--------------------------------------------------------------+
| /* Generate Style value */ |
| nStyle := nAnd( C_MASK, C_VISIBLE, C_ACTIVE ) // -> 0101b |
+--------------------------------------------------------------+
In this Example, the style flag would be 0101b, which is 5 decimal. This
way, you can store a lot of informations in one numerical variable !
SOURCE:
SOURCE\FUNCTION\OR.C
See Also:
nOr
lAnd
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson