On this page
packet.set_bit
Sets (on = true) or clears (on = false) one bit of a payload byte.
Syntax
Atlas Script
packet.set_bit(offset, bit, on)Parameters
offset- Byte offset into the packet. Payload-relative for packet.* methods, and absolute (whole IP packet) for the raw_* variants.
bit- Bit index within the byte, 0 for the least-significant bit through 7.
on- Boolean bit state: true sets the selected bit and false clears it.
Return value
See the remarks for the returned value and runtime behavior.
Remarks
Sets (on = true) or clears (on = false) one bit of a payload byte. An offset or bit out of range does nothing.
Examples
Usage pattern
// Replace offset, bit, on with values described above.
packet.set_bit(offset, bit, on);