BOR (return bitwise OR)

Top  Previous  Next

 

BOR(value,mask)

BOR

Performs bitwise OR 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 BOR procedure compares the value to the mask, performing a Boolean OR operation on each bit. The return value is a LONG integer with a one (1) in the bit positions where the value, or the mask, or both, contain a one (1), and zeroes in all other bit positions.

BOR is usually used to unconditionally turn on (set to one), an individual bit, or multiple bits, within a variable.

Return Data Type:

LONG

Example:

!BOR(0110b,0010b) returns 0110b  !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

RateType = BOR(RateType,Over25) !Turn on over 25 bit

RateType = BOR(RateType,Male)   !Set rate to male

 

See Also:

BAND

BXOR

BSHIFT