Whatever message this page gives is out now! Go check it out!

BitMaskSet

Last update:
May 18, 2026

Description

Performs a bitwise mask set operation.

Returns

A number, bitwise masked with length bits of mask beginning at start.

Category

Function syntax

BitMaskSet(number, mask, start, length)

See also

Parameters

Parameter
Description
number
32-bit signed integer
mask
32-bit signed integer; mask
start
Integer, in the range 0-31, inclusive; start bit for mask
length
Integer, in the range 0-31, inclusive; length of mask

Usage

Bit functions operate on 32-bit signed integers, in the range -2147483648 - 2147483647.

Example

<h3>BitMaskSet Example</h3> 
 <p>Returns number bitwise masked with length bits of mask beginning at start.</p> 
 
 <p>BitMaskSet(255, 255, 4, 4): <cfoutput>#BitMaskSet(255, 255, 4, 4)#</cfoutput></p> 
 <p>BitMaskSet(255, 0, 4, 4): <cfoutput>#BitMaskSet(255, 0, 4, 4)#</cfoutput></p> 
 <p>BitMaskSet(0, 15, 4, 4): <cfoutput>#BitMaskSet(0, 15, 4, 4)#</cfoutput></p>

Example

<cfscript>
  number = 0 ;
  mask = 15 ;
  start = 4;
  length = 4;
  writeOutput(bitmaskset(number, mask, start, length)) ;
</cfscript>

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page