ezeio2:scriptref: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
  • ezeio2/scriptref/getbit.txt
  • Last modified: 2020-08-14 20:40
  • by andreh