bitMaskRead

Performs a bitwise mask read operation.
Returns an integer representation of the corresponding bits specified in the mask.

bitMaskRead(number, start, length) → returns Numeric

Argument Reference for the bitMaskRead function

number

Required: Yes
Integer

start

Required: Yes
Start bit for the read mask (Integer in the range 0-31, inclusive)

length

Required: Yes
Length of bits in the read mask (Integer in the range 0-31, inclusive)

Examples sample code invoking the bitMaskRead function


Bitwise Mask Read

Uses the bitMaskRead function to read each of the corresponding bits specified in the mask

bitMaskRead(3, 0, 1)

Expected Result: 1


Using non zero start parameter

Bit shift the mask 2 places

bitMaskRead(10, 2, 1)

Expected Result: 0


Using non zero read mask start and length parameters

bitMaskRead(10, 1, 3)

Expected Result: 5


Fork me on GitHub