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

GetBit

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

Description#

GetBit( buffer, bitno )

Get the state of a single bit in a buffer

Parameters#

buf Reference to the byte buffer
bitno The bit number (0-indexed)

Return value#

Returns the state of the bit (1 or 0)

Example usage#

   new buffer{80};
   new b;
 
   // assuming the buffer is filled with data
 
   b = GetBit(buffer, 18);
 
   // b is the status of the 19th bit in the buffer

Last updated Aug 14, 2020