ClearBit
Result = ClearBit(Value, BitNo)
 
Parameters:

    Value = An integer value
    BitNo = The bit you want to clear (0 = least significant bit)
Returns:

    Result = Result after the bit was cleared
 

      ClearBit clears a specified bit of a given value. 0 is the least significant bit (LSB), 31 is the most significant bit (MSB).



FACTS:


     * If the specified bit is already cleared ClearBit will not change it.

     * You can also us ethe And operator to clear groups of bits.



Mini Tutorial:


Showing the effect of ClearBit

  
; Clear the bits 0 to 7 of the value 255 and
; display only these 8 bits using the Right$ function
  For i = 0 To 7
   ; clear a bit from the 255.
   ; 255 decimal in binary = %111111111
     Value=ClearBit(255,i)
     
   ; display this value in binary format
     Print Right$Bin$(Value ),8)
  Next i
  
; Display the Screen and wait for the user to press a key
  Sync
  WaitKey
  



This example would output.

  
  11111110
  11111101
  11111011
  11110111
  11101111
  11011111
  10111111
  01111111
  


 
Related Info: And | Or | SetBit | SwapBit | TestBit | Xor :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com