Bitfield
Last update: 17.07.2025The BitField library provides a set of operations on arrays of bits or integers seen as array of bits, with conversion from/to array of Boolean values. It also provides operators to make/split bit-fields from/to bytes.
| Operator Name | Description |
|---|---|
| BitsMask | Returns a mask of a number of bits at the given position. |
| ClrBit | Returns the input with the bit set to 0 at the given position. |
| ClrBitMask | Returns the input with the bits set to 0 as per the corresponding Mask bits when set to value 1 and remaining bits will retain their original values. |
| CopyBit | Returns the input with the bit at the given position copied from the source at another position. |
| FromBool | Returns a bit-field from an array of Boolean values. |
| FromByte | Returns a bit-field from an array of bytes. |
| GetBit | Returns whether the bit at the given position of the input is 1. |
| GetBits | Returns a number of bits for the input starting at the given position. |
| High | Returns the bit-field with the most significant bits of the input. |
| Low | Returns the bit-field with the least significant bits of the input. |
| Make | Returns a bit-field from the concatenation of two bit-fields. |
| PutBit | Returns the input with the bit set to 1 if status, otherwise 0, at the given position. |
| PutBits | Returns the input with a number of bits of the pattern copied at the given position. |
| PutBitsMask | Returns the input with the bits from pattern copied, with respect to a mask. |
| RotBitLt | Returns the input with all bits rotated to the left by a number. The most significant bit is rotated to the least significant bit location for every single bit shift cycle. |
| RotBitRt | Returns the input with all bits rotated to the right by a number. The least significant bit is rotated to the most significant bit location for every single bit shift cycle. |
| SetBit | Returns the input with the bit set to 1 at the given position. |
| SetBitMask | Returns the input with the bits set to 1 as per the corresponding Mask bits when set to value 1 and the remaining bits will retain their original values. This is equivalent to the operator lor. |
| SetBits | Returns the input with a number of bits set to either 0 or 1, starting at the given position. |
| ShiftBitLt | Returns the input with all bits shifted to the left by a number. The least significant bits (right-most bit) are replaced by 0 and the most significant bits (left-most bit) are discarded. This is equivalent to the operator lsl. |
| ShiftBitRt | Returns the input with all bits shifted to the right by a number. The most significant bits (left-most bit) are replaced by 0 and the least significant bits (right-most bit) are discarded. This is equivalent to the operator lsr. |
| Split | Returns the input split in two parts. |
| ToBool | Returns an array of Boolean values from the input. |
| ToByte | Returns an array of bytes from the input. |
| ToggleBitMask | Returns the input with the bits toggled when the corresponding bit of the mask is 1 and the remaining bits will retain their original values. This is equivalent to the operator lxor. |
| ToggleBits | Returns the input with all bits toggled: 0 replaced by 1 and vice versa. This is equivalent to the operator lnot. |
| TstBitLnMask | Returns whether at least one of the bits defined in mask is set in the input. |
| TstBitMask | Returns whether all bits defined in mask are set in the input. |
| TstParityEven | Returns whether the number of bits defined and set to 1 if the input is even. |
Parent topic:Libraries