bitset
Set bit at a specified position.
📝Syntax
r = bitset(A, pos)
r = bitset(A, pos, val)
📥Input Arguments
Parameter Description
A an integer array.
pos the bit position (1 is the least significant bit).
val the bit value, 0 or 1 (default 1).
📤Output Arguments
Parameter Description
r A with the bit at pos set to val.
📄Description

r = bitset(A, pos) sets the bit at position pos of A to 1.

r = bitset(A, pos, val) sets that bit to val.

💡Examples
bitset(uint8(0), 3)
🔗See Also
bitgetbitand
🕔Version History
Version Description
2.0.0 initial version
Edit this page on GitHub