BitMaskSet

Performs a bitwise mask set operation.

Method Signature

BitMaskSet(number=[integer], mask=[integer], start=[integer], length=[integer])

Arguments

Argument
Type
Required
Description
Default

number

integer

true

Numeric value for the bitwise mask set.

mask

integer

true

Numeric value for the mask.

start

integer

true

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

length

integer

true

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

Examples

Bitwise Mask Set

Performs masking operation on each of the corresponding bits

Run Example

bitMaskSet( 6, 1, 0, 1 );

Result: 7

Using non zero start parameter

Bit shift the mask 2 places

Run Example

bitMaskSet( 10, 1, 2, 1 );

Result: 14

Using non zero mask start and length parameters

Run Example

bitMaskSet( 10, 2, 1, 2 );

Result: 12

Additional Examples

Run Example

writeOutput( bitMaskSet( 255, 255, 5, 5 ) );
writeOutput( "<br>" );
writeOutput( bitMaskSet( 255, 15, 0, 4 ) );

Last updated

Was this helpful?