=head1	NAME

dkbf - bit field operations

=head1	SYNOPSIS

  #include <dkbf.h>

  dk_bitfield_t *dkbf_open(size_t bits);

  void dkbf_set(dk_bitfield_t *bf, size_t bit, int val);

  int dkbf_get(dk_bitfield_t *bf, size_t bit);

  void dkbf_close(dk_bitfield_t *bf);

  void dkbf_reset(dk_bitfield_t *bf);

  dk_bitmatrix_t *dkbf_matrix_open(size_t columns, size_t rows);

  void dkbf_matrix_set(dk_bitmatrix_t *bm, size_t x, size_t y, int val);

  int dkbf_matrix_get(dk_bitmatrix_t *bm, size_t x, size_t y);

  void dkbf_matrix_reset(dk_bitmatrix_t *bm);

  void dkbf_matrix_close(dk_bitmatrix_t *bm);

=head1	DESCRIPTION

The dkbf module operates on bit fields.

The dkbf_open() function dynmically creates a new bit field for
the given number of I<bits>.
On success a pointer to the new bit field is returned, NULL on error.

The dkbf_close() function destroys a bitfied.

The dkbf_set() function sets a bit to either 0 (val=0) or 1 (val!=0).

The dkbf_get() function retrieves a bit value.

The dkbf_reset() functions resets all bits in a bit field.

The dkbf_matrix_open() function creates a bit matrix having the specified
number of columns and rows.

The dkbf_matrix_close() function destroys a bit matrix and releases the
memory used by the bit matrix.

The dkbf_matrix_set() function sets or resets a bit at the specified
position.

The dkbf_matrix_get() function retrieves a bit from the specified position.

The dkbf_matrix_reset() function resets all bits in a bit matrix.

=head1	AUTHOR

Dirk Krause

=head1	COPYRIGHT AND LICENSE

Copyright (c) 2001-2008, Dirk Krause
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

 * Redistributions of source code must retain the above
   copyright notice, this list of conditions and the
   following disclaimer.

 * Redistributions in binary form must reproduce the above
   copyright notice, this list of conditions and the following
   disclaimer in the documentation and/or other materials
   provided with the distribution.

 * Neither the name of the Dirk Krause nor the names of
   contributors may be used to endorse or promote products
   derived from this software without specific prior written
   permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
