The package for work with bit strings is used to implement package `IEEE'. But of course the package can be used for solving other tasks.

Here a bit is given by address (start address) of byte from which counting bits starts and its displacement which is any non negative number of bit from the start address. The most significant bit of the start address byte has number 0. The bit string is given by its first bit and its length in bits.

The interface part of the package is file `bits.h'. The implementation part is file `bits.c'. The interface contains the following external definitions of macros and functions:

**Macro `BIT'**

returns given bit value as integer value `0' or `1'. There is macro `SET_BIT (start_byte, bit_displacement, bit) for changing value of a bit. Parameter `bit' must have value `0' or `1'.`BIT(start_byte, bit_displacement)'

**Function `is_zero_bit_string'**

returns `1' if given bit string contains only zero value bits, 0 otherwise.`int is_zero_bit_string (const void *start_byte, int bit_displacement, int bit_length)'

**Function `bit_string_set'**

sets up new value of all bits of given bit string. This function is bit string analog of standard C function `memset'.`void bit_string_set (void *start_byte, int bit_displacement, int bit, int bit_length)'

**Function `bit_string_copy'**

copys a bit string to another bit string. The bit strings must be nonoverlapped. This function is bit string analog of standard C function `memcpy'.`void bit_string_copy (void *to, int to_bit_displacement, const void *from, int from_bit_displacement, int bit_length)'

**Function `bit_string_move'**

copys a bit string to another bit string. The bit strings can be overlapped. This function is bit string analog of standard C function `memmove'.void bit_string_move (void *to, int to_bit_displacement, const void *from, int from_bit_displacement, int bit_length)'

**Function `bit_string_comparison'**

returns 0 if the bit strings are equal, 1 if the first bit string is greater than the second, -1 if the first bit string is less than the second. This function is bit string analog of standard C function `memcmp'.`int bit_string_comparison (const void *str1, int bit_displacement1, const void *str2, int bit_displacement2, int bit_length)'

Next Previous Contents