Elatec GmbH
Page 44 of 50
void CopyBits(byte &DestBits, byte StartDestBit, byte &SourceBits,
byte StartSourceBit, byte BitCount)
Copy bits from a source to a destination. Source and destination may be identical and the source
section may overlap the destination. Depending on that, the correct method for copying will be chosen.
Parameters:
byte &DestBits
Reference to an array of bytes which represent a bit field which is the
destination of the copy operation.
byte StartDestBit
First bit within the destination bit field where the bits are copied to.
byte &
SourceBits
Reference to an array of bytes which represents a bit field which is the
source of the copy operation
byte StartSourceBits
First bit within the source bit field where the bits are copied from.
byte
BitCount
Number of bits to be copied.
Return:
None.
void FillBits(byte &Dest, byte StartBit, byte Value, byte BitCount)
Fill bits within a given bit field with either 0 or 1.
Parameters:
byte &Dest
Reference to an array of bytes which represent a bit field which is the
destination for the operation.
byte StartBit
First bit within the bit field where the bits are filled.
byte Value
The bit value which is either 0 or 1.
byte
BitCount
Number of bits to be filled.
Return:
None.
void SwapBits(byte &Data, byte StartBit, byte BitCount)
Swap the order of bits within a bit field.
Parameters:
byte &Data
Reference to an array of bytes which represent a bit field which is the
destination for the operation.
byte StartBit
First bit within the bit field where bits are swapped.
byte
BitCount
Number of bits to be swapped.
Return:
None.