


Constant Summary 
array array integer 
reverseBits 
 Array to reverse the bits of small numbers.  
Function Summary 
integer 
getBitLsb (in string: stri, inout integer: bytePos,
inout integer: bitPos) 
 Get one bit in LSBFirst order from stri.  
integer 
getBitsLsb (in string: stri, inout integer: bytePos,
inout integer: bitPos, in var integer: bitWidth) 
 Get bitWidth bits in LSBFirst order from stri.  
void 
putBitLsb (inout string: stri, inout integer: bitPos, in integer: bit) 
 Append one bit in LSBFirst order to stri.  
void 
putBitsLsb (inout string: stri, inout integer: bitPos, in var integer: bits,
in var integer: bitWidth) 
 Append bitWidth bits in LSBFirst order to stri.  
integer 
getBitMsb (in string: stri, inout integer: bytePos,
inout integer: bitPos) 
 Get one bit in MSBFirst order from stri.  
integer 
getBitsMsb (in string: stri, inout integer: bytePos,
inout integer: bitPos, in var integer: bitWidth) 
 Get bitWidth bits in MSBFirst order from stri.  
void 
putBitMsb (inout string: stri, inout integer: bitPos, in integer: bit) 
 Append one bit in MSBFirst order to stri.  
void 
putBitsMsb (inout string: stri, inout integer: bitPos, in var integer: bits,
in var integer: bitWidth) 
 Append bitWidth bits in MSBFirst order to stri.  
integer 
getBitLsb (inout file: inFile, inout integer: bitPos) 
 Get one bit in LSBFirst order from inFile.  
integer 
getBitsLsb (inout file: inFile, inout integer: bitPos,
in var integer: bitWidth) 
 Get bitWidth bits in LSBFirst order from inFile.  
reverseBits
const array array integer: reverseBits 
Array to reverse the bits of small numbers.
The first index is the number of bits to be reversed (between 2 and 9).
The second index is the number for which the bits should be reversed.
reverseBits[2][2#10] returns 2#1
reverseBits[4][2#1101] returns 2#1011
reverseBits[6][2#110101] returns 2#101011
getBitLsb
const func integer: getBitLsb (in string: stri, inout integer: bytePos,
inout integer: bitPos) 
Get one bit in LSBFirst order from stri.
The bit is read at the current byte and bit position. Afterwards
byte and bit position are advanced by one bit. The read
direction is from LSB (least significant bit) to MSB (most significant bit).
 Parameters:
 stri  String of bytes from which the bit is read.
 bytePos  Current byte position in stri.
 bitPos  Current bit position between 0 (=LSB) and 7 (=MSB).
 Raises:
 RANGE_ERROR  When the end of stri has been reached.
getBitsLsb
const func integer: getBitsLsb (in string: stri, inout integer: bytePos,
inout integer: bitPos, in var integer: bitWidth) 
Get bitWidth bits in LSBFirst order from stri.
The bits are read at the current byte and bit position. Afterwards
byte and bit position are advanced by bitWidth bits. The read
direction is from LSB (least significant bit) to MSB (most significant bit).
When bits from the next byte(s) are read a byte order of littleendian
is used.
stri := "\2#01101011;\2#1110;"; bytePos := 1; bitPos := 5;
# 011 10
# lower bits higher bits
# of result of result
getBitsLsb(stri, bytePos, bitPos, 5) returns 2#10011 (bytePos=2, bitPos=2)
 Parameters:
 stri  String of bytes from which the bits are read.
 bytePos  Current byte position in stri.
 bitPos  Current bit position between 0 (=LSB) and 7 (=MSB).
 bitWidth  Number of bits requested.
 Raises:
 RANGE_ERROR  When the end of stri has been reached.
putBitLsb
const proc: putBitLsb (inout string: stri, inout integer: bitPos, in integer: bit) 
Append one bit in LSBFirst order to stri.
The bit is appended to stri at the current bit position.
Afterwards the bit position is advanced by one bit. The append
direction is from LSB (least significant bit) to MSB (most significant bit).
If necessary stri is enlarged.
 Parameters:
 stri  String of bytes to which the bit is appended.
 bitPos  Current bit position between 0 (=LSB) and 7 (=MSB).
 bit  Bit to be appended to stri.
putBitsLsb
const proc: putBitsLsb (inout string: stri, inout integer: bitPos, in var integer: bits,
in var integer: bitWidth) 
Append bitWidth bits in LSBFirst order to stri.
The bits are appended to stri at the current bit position. Afterwards
the bit position is advanced by bitWidth bits. The append
direction is from LSB (least significant bit) to MSB (most significant bit).
If necessary stri is enlarged with bytes in littleendian byte order.
stri := "\2#01011;"; bitPos := 5;
putBitsLsb(stri, bitPos, 2#10011, 5);
# Now holds: stri = "\2#01101011;\2#10;" and bitPos = 2
# 011 10
# appended appended
# lower bits higher bits
 Parameters:
 stri  String of bytes to which the bits are appended.
 bitPos  Current bit position between 0 (=LSB) and 7 (=MSB).
 bits  Bits to be appended to stri.
 bitWidth  Number of bits to be appended (width of bits).
getBitMsb
const func integer: getBitMsb (in string: stri, inout integer: bytePos,
inout integer: bitPos) 
Get one bit in MSBFirst order from stri.
The bit is read at the current byte and bit position.
Afterwards byte and bit position are advanced by one bit. The read
direction is from MSB (most significant bit) to LSB (least significant bit).
 Parameters:
 stri  String of bytes from which the bit is read.
 bytePos  Current byte position in stri.
 bitPos  Current bit position between 0 (=MSB) and 7 (=LSB).
 Raises:
 RANGE_ERROR  When the end of stri has been reached.
getBitsMsb
const func integer: getBitsMsb (in string: stri, inout integer: bytePos,
inout integer: bitPos, in var integer: bitWidth) 
Get bitWidth bits in MSBFirst order from stri.
The bits are read at the current byte and bit position. Afterwards
byte and bit position are advanced by bitWidth bits. The read
direction is from MSB (most significant bit) to LSB (least significant bit).
When bits from the next byte(s) are read a byte order of bigendian is used.
stri := "\2#01011100;\2#11010110;"; bytePos := 1; bitPos := 5;
# 100 11
# higher bits lower bits
# of result of result
getBitsMsb(stri, bytePos, bitPos, 5) returns 2#10011 (bytePos=2, bitPos=2)
 Parameters:
 stri  String of bytes from which the bits are read.
 bytePos  Current byte position in stri.
 bitPos  Current bit position between 0 (=MSB) and 7 (=LSB).
 bitWidth  Number of bits requested.
 Raises:
 RANGE_ERROR  When the end of stri has been reached.
putBitMsb
const proc: putBitMsb (inout string: stri, inout integer: bitPos, in integer: bit) 
Append one bit in MSBFirst order to stri.
The bit is appended to stri at the current bit position.
Afterwards the bit position is advanced by one bit. The append
direction is from MSB (most significant bit) to LSB (least significant bit).
If necessary stri is enlarged.
 Parameters:
 stri  String of bytes to which the bit is appended.
 bitPos  Current bit position between 0 (=MSB) and 7 (=LSB).
 bit  Bit to be appended to stri.
putBitsMsb
const proc: putBitsMsb (inout string: stri, inout integer: bitPos, in var integer: bits,
in var integer: bitWidth) 
Append bitWidth bits in MSBFirst order to stri.
The bits are appended to stri at the current bit position. Afterwards
the bit position is advanced by bitWidth bits. The append
direction is from MSB (most significant bit) to LSB (least significant bit).
If necessary stri is enlarged with bytes in bigendian byte order.
stri := "\2#01011000;";
putBitsMsb(stri, bitPos, 2#10011, 5);
# Now holds stri = "\2#01011100;\2#11000000;" and bitPos = 2
# 100 11
# appended appended
# higher bits lower bits
 Parameters:
 stri  String of bytes to which the bits are appended.
 bitPos  Current bit position between 0 (=MSB) and 7 (=LSB).
 bits  Bits to be appended to stri.
 bitWidth  Number of bits to be appended (width of bits).
getBitLsb
const func integer: getBitLsb (inout file: inFile, inout integer: bitPos) 
Get one bit in LSBFirst order from inFile.
The bit is read at the current byte and bit position. Afterwards
byte and bit position are advanced by one bit. The read
direction is from LSB (least significant bit) to MSB (most significant bit).
 Parameters:
 inFile  File of bytes from which the bit is read.
 bitPos  Current bit position between 0 and 8. 0 = LSB, 7 = MSB, 8 = A bitPos of 0 (=LSB) in the next byte.
 Raises:
 FILE_ERROR  When reading from inFile fails.
getBitsLsb
const func integer: getBitsLsb (inout file: inFile, inout integer: bitPos,
in var integer: bitWidth) 
Get bitWidth bits in LSBFirst order from inFile.
The bits are read at the current byte and bit position. Afterwards
byte and bit position are advanced by bitWidth bits. The read
direction is from LSB (least significant bit) to MSB (most significant bit).
When bits from the next byte(s) are read a byte order of littleendian
is used.
 Parameters:
 inFile  File of bytes from which the bits are read.
 bitPos  Current bit position between 0 and 8. 0 = LSB, 7 = MSB, 8 = A bitPos of 0 (=LSB) in the next byte.
 bitWidth  Number of bits requested.
 Raises:
 FILE_ERROR  When reading from inFile fails.


