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


SetBit( buffer, bitno, value )

Set the state of a single bit in a buffer


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);
  • ezeio2/scriptref/setbit.txt
  • Last modified: 2020-08-14 20:42
  • by andreh