Skip to content
Homes32 edited this page May 14, 2022 · 2 revisions

BitSet

Set a specific bit in a binary string.

Syntax

BitSet,<BitArray>,<BitGroup>,<BitPosition>[,BitSize]

Arguments

Argument Description
BitArray A comma separated string of bits in hex format.
BitGroup The specific group of bits to manipulate. This is determined by the 1-based index of the bit group supplied by BitArray. Example: In order to set a a bit in value DB in 01,DB,1A,4C we would specify a BitGroup of 2.
BitPosition The binary position to modify. (0-based Right to Left)
BitSize (Optional) Specify the bitsize (8,16,32,64) used. Default is 32.

Return Codes

Variable Description
#r Returns BitArray with the specified bit set.

Remarks

None.

Related

ApplyBitMask, BitClear, BitToggle

Examples

Example 1

Set bit 0 in the 8bit group 5 of the array 90,01,00,00,64,00,00,00,64,00

[Main]
Title=BitSet Example
Description=Show usage of the BitSet Command
Author=Homes32
Level=5
Version=1

[Variables]
%ProgramSettings%=90,01,00,00,64,00,00,00,64,00

[Process]
BitClear,%ProgramSettings%,5,0,8

Result: 90,01,00,00,65,00,00,00,64,00