Skip to content
ezeioDocs
  1. Reference
  2. Script reference
  3. Bits

SetBit

Helper function to set the state of a single bit in a byte-buffer.

Description#

SetBit( buffer, bitno, value )

Set the state of a single bit in a buffer

Parameters#

buf Reference to the byte buffer
bitno The bit number (0-indexed)
value 0 or 1 (any non-zero value is considered =1)

Return value#

Returns the state of the bit (1 or 0) before it was set.

Example usage#

   new buffer{80};
 
   SetBit(buffer, 18, 1);

Last updated Aug 14, 2020