Click or drag to resize

BitWiseCopyBits Method

Copies a subset block of bits from one unsigned integer to another.

Namespace:  RRAutoLib.Loconet
Assembly:  RRAutoLib (in RRAutoLib.dll) Version: 4.0.8678.28884
Syntax
Public Shared Function CopyBits ( 
	intSource As UInteger,
	bytSrcLoc As Byte,
	bytSrcLen As Byte,
	ByRef intTarget As UInteger,
	bytTrgLoc As Byte
) As UInteger

Parameters

intSource
Type: SystemUInt32
Bit source to copy from.
bytSrcLoc
Type: SystemByte
Start location of the source bit block. Location is zero based where zero is the least significant bit and the location is the least significant bit of the block.
bytSrcLen
Type: SystemByte
Number of bits in the block to copy from the source bytes. Bits are counted from right to left starting at bytSrcLoc.
intTarget
Type: SystemUInt32
Bit target to copy over. Results are returned through this parameter as well as the function's return value.
bytTrgLoc
Type: SystemByte
Start location of the target bit block. Location is zero based where zero is the least significant bit and the location is the least significant bit of the block.

Return Value

Type: UInt32
Examples
Given a byte S of [S7,S6,S5,S4,S3,S2,S1,S0] and a byte T of [T7,T6,T5,T4,T3,T2,T1,T0] the following example will copy the bits in bold from S overwritting the bits in T resulting in [T7,T6,T5,T4,S6,S5,S4,T0]. Original bits, other than the three overwritten, are left as they were.
VB
CopyBits(S, 4, 3, T, 1)
See Also