BITSET( ) Function

Sets the bit to 1 in a numeric value and returns the resulting value.

BITSET(nExpression1, nExpression2)

Return Values

Numeric

Parameters

  • nExpression1
    Specifies the numeric value in which a bit is set. If nExpression1 is not an integer, it is converted to an integer before its bit is set.
  • nExpression2
    Specifies the bit position in nExpression1 that is set to 1. nExpression2 can range from 0 to 31; 0 is the rightmost bit.

Example

x = 5  && 0101 binary
y = 1  && 2nd bit position (0 = 1st bit position)
? BITSET(x,y) && Returns 7, 0111 binary

See Also

BITAND( ) | BITCLEAR( ) | BITLSHIFT( ) | BITNOT( ) | BITOR( ) | BITRSHIFT( ) | BITTEST( ) | BITXOR( )