Series 2600B System SourceMeter® instrument Reference Manual Section 9: TSP command reference
2600BS-901-01 Rev. F/August 2021 9-13
bit.set()
This function sets a bit at the specified index position.
Usage
result = bit.set(value, index)
Result of the bit manipulation
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 of 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
testResult = bit.set(8, 3)
print(testResult)
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.20000e+01
Also see
Bit manipulation and logic operations (on page 7-4)
bit.clear() (on page 9-10)
bit.get() (on page 9-11)
bit.getfield() (on page 9-12)
bit.setfield() (on page 9-14)
bit.test() (on page 9-15)
bit.toggle() (on page 9-16)