ezeio2:scriptref:setcellbit

Helper function to set the state of a single bit in a cell value.

Description

SetCellBit( cell, bitno, value )

Set the state of a single bit in a cell variable

Parameters

cell The cell variable to manipulate
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 v = 9;  // 9 = binary 1001
   new b;
 
   b = SetCellBit( v, 2, 1 );
 
   // v is now 13 (binary 1101)
   // b is 0 (previous value of bit 2)
  • ezeio2/scriptref/setcellbit.txt
  • Last modified: 2024-04-10 18:08
  • by andreh