bitMaskSet

Performs a bitwise mask set operation.

bitMaskSet(number, mask, start, length) → returns Numeric

Argument Reference for the bitMaskSet function

number

Required: Yes
Integer

mask

Required: Yes
Integer mask

start

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

length

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

Examples sample code invoking the bitMaskSet function


Bitwise Mask Set

Performs masking operation on each of the corresponding bits

bitMaskSet(6, 1, 0, 1)

Expected Result: 7


Using non zero start parameter

Bit shift the mask 2 places

bitMaskSet(10, 1, 2, 1)

Expected Result: 14


Using non zero mask start and length parameters

bitMaskSet(10, 2, 1, 2)

Expected Result: 12


Fork me on GitHub