BIT STRING

This built-in type is used to model information which is madu up of ordered sequence of bits. It can be of any non-negative integer length, including zero. Since a bit carries the same information as a BOOLEAN type, bit string can be used as a model of collection of two-state variables. Here are examples:

The main difference in values are that they do not represent a value, but a possition in defined bit string. The first bit in a bit string has the number 0, last or so-called trailing bit in a n-bit long string has number n-1.

The value notation alows three different forms: binary, hexadecimal and identifier based. Last mentioned is of course available only if identifiers are defined and means assigning a logical 1 to appropriate bit. Binary and hexadecimal notation uses the 0th bit as the most significant, so 1010 will be 0AH, not 5H. Here are some examples:

The first two examples are defining the same mask, because convention says that leading zeros are insignificant. It is useful for adding new attributes with keeping on compatibility. In this case, the hexadecimal form is always available, othervise the length of bit string must be a multiple of four.

It is also possible to define bit string of specified size using the SIZE keyword: