Bit Set

Sets a bit in a number to 1 or 0

Syntax

newValue = Bit Set (oldValue, bitIndex, onOff)

Description

This command allows you to set the bit at index bit in oldValue to either 1 or 0.

If onOff is passed as 0 then the bit is set to 0. If onOff is non-zero then the bit is set to 1.

The bit indexes are numbered 0 through to 31, where 0 is the least significant bit, and 31 is the most significant bit.

It is possible to test if an individual bit is already set using the Bit Test command.

Table of contents