SETOFF

The SETOFF function sets to zero a specified bit in a binary number. You can use this function to manipulate (turn off) a bit in a binary number.

Syntax:
SETOFF ( single-binary-number-expression, single-integer-expression )
Meaning:
SETOFF ( binary_number_to_change, bit_to_turn_off )
Returns:
A single binary number

The SETOFF function uses bit_to_turn_off to specify the bit of binary_number_to_change to be set to the value 0. The result is a binary number item of the same size as binary_number_to_change.

The value of bit_to_turn_off represents the position of the single bit in binary_number_to_change to be set off. (Bits are numbered from left to right, with the leftmost bit being bit 1.) If bit_to_turn_off is less than one or greater than the number of bits of binary_number_to_change, SETOFF returns binary_number_to_change unchanged.

Examples

  • SETOFF ( A , 16 )

    Assume A is the two-byte binary value of "1" (which is all zeros except for bit 16). The binary representation of the value in A is 0001.

    The result is the two-byte binary value, "0"

  • SETOFF ( A , 38 )

    Results in the two-byte binary value "1", the original value of A, because bit 38 does not exist in A.