User Tools

Site Tools


band_return_bitwise_and_.htm
Navigation:  Language Reference > 13 - Built-in Functions >====== BAND (return bitwise AND) ====== Previous pageReturn to chapter overviewNext page

BAND(value,mask)

blk2blue.jpg

BAND Performs bitwise AND operation.
value A numeric constant, variable, or expression for the bit value to be compared to the bit mask. The value is converted to a LONG data type prior to the operation, if necessary.
mask A numeric constant, variable, or expression for the bit mask. The mask is converted to a LONG data type prior to the operation, if necessary.

The BAND procedure compares the value to the mask, performing a Boolean AND operation on each bit. The return value is a LONG integer with a one (1) in the bit positions where the value and the mask both contain one (1), and zeroes in all other bit positions.

BAND is usually used to determine whether an individual bit, or multiple bits, are on (1) or off (0) within a variable.

Return Data Type: LONG

Example:

!BAND(0110b,0010b) returns 0010b !0110b = 6, 0010b = 2

RateType  BYTE                 !Type of rate

Female    EQUATE(0001b)        !Female mask

Male      EQUATE(0010b)        !Male mask

Over25    EQUATE(0100b)        !Over age 25 mask

CODE

IF BAND(RateType,Female)|     !If female

  AND BAND(RateType,Over25)   ! and over 25

 DO BaseRate                  !use base premium

ELSIF BAND(RateType,Male)     !If male

 DO AdjBase                   !adjust base premium

END  

See Also:

BOR

BXOR

BSHIFT

band_return_bitwise_and_.htm.txt · Last modified: 2021/04/15 15:56 by 127.0.0.1