CopyBits
Result = CopyBits(SrcValue, BitCount, DestValue, BitPos)
 
Parameters:

    SrcValue = The source value
    BitCount = Number of bits that will be copied
    DestValue = The destination value
    BitPos = The bit position in DestValue
Returns:

    Result
 

      The CopyBits copies the number of bits given in BitCount from DestValue to the bit position specified in BitPos of DestValue.




FACTS:


      * Use CopyBits to insert a number bits at a specified position.




Mini Tutorial:


      Showing the use of the function CopyBits

  
; assign values to variables SrcValue and DestValue
  SrcValue=$11223344
  DestValue = $AABBCCDD
  
; Display the values in Hex format
  Print Hex$(SrcValue)
  Print Hex$(DestValue)
  
; Copy 8 bits of SrcValue to Dest value at bit 24
  Print Hex$(CopyBits(SrcValue, 8, DestValue, 24))
  
; Copy 16 bits of SrcValue to Dest value at bit 32
  Print Hex$(CopyBits(SrcValue, 16, DestValue, 32))
  
; Display the output and wait for key.
  Sync
  WaitKey
  



This example would output.

  
  $11223344
  $AABBCCDD
  $AA44CCDD
  $3344CCDD
  

 
Related Info: And | ClearBit | Or | Xor :
 


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