Section 7: Command reference
Models 707B and 708B Switching Matrix Reference Manual
7-14
707B-901-01 Rev. A / August 2010
bit.set()
This function sets a bit at the specified index position.
Type
TSP-Link accessible
Affected by
Where saved
Default value
Function No
Usage
result = bit.set(value, index)
result
Result of the bit manipulation
value
Specified number
index
One-based bit position within
value
to set (1 to 32)
Details
This function returns
result
, which is
value
with the indexed bit set. The
index
must be between 1 and 32.
The least significant bit
value
is at
index
position 1; the most significant bit is at
index
position 32.
Any fractional part of
value
is truncated to make it an integer.
Example
myResult = bit.set(8, 3)
print(myResult)
The binary equivalent of decimal 8 is 1000. If the bit at
index
position 3 is set to 1, the returned value is
decimal 12 (binary 1100).
Output:
1.201
Also see
(on page 7-13)
(on page 7-15)
(on page 7-17)
(on page 6-22)