Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
BITARR(3)		     C Programmer's Manual		     BITARR(3)

NAME
       ba_and_ba,  ba_clear,  ba_clear_all,  ba_copy,  ba_create,  ba_destroy,
       ba_not, ba_or_ba, ba_or_not_ba, ba_query, ba_resize, ba_set,  ba_xor_ba
       - bit array manipulation

SYNOPSIS
       #include	<bitarr.h>

       Bitarr *ba_create(void);
       void ba_destroy(Bitarr *ba);
       Bitarr *ba_copy(const Bitarr *ba);
       int ba_resize(Bitarr *ba, size_t	max_number);

       int ba_set(Bitarr *ba, unsigned number);
       int ba_clear(Bitarr *ba,	unsigned number);
       void ba_clear_all(Bitarr	*ba);
       int ba_query(Bitarr *ba,	unsigned number);
       void ba_and_ba(Bitarr *ba1, const Bitarr	*ba2);
       int ba_or_ba(Bitarr *ba1, const Bitarr *ba2);
       void ba_xor_ba(Bitarr *ba1, const Bitarr	*ba2);
       void ba_or_not_ba(Bitarr	*ba1, const Bitarr *ba2);
       void ba_not(Bitarr *ba);

DESCRIPTION
       These  functions	 operate  on  bit  arrays.   ba_create creates one and
       ba_destroy it.  ba_copy makes a copy of one, and	ba_resize changes  its
       size.   The  bit	 arrays	resize themselves automatically, but ba_resize
       can be used to get rid of extra memory allocated	for the	array,	or  to
       make  sure there	is enough memory allocated for the array (so that fur-
       ther operations are guaranteed to work).

       ba_set sets one element (bit) in	the array to 1.	 ba_clear  clears  one
       element (sets it	to 0), ba_clear_all clears all elements.  ba_query re-
       turns the current value of an element.

       ba_and_ba, ba_or_ba, ba_xor_ba, and ba_or_ba do logical	operations  on
       two  arrays.   The result will be stored	in the first one.  ba_not will
       invert all elements in the array.

RETURNS
       ba_create and ba_copy return a pointer to the new  array,  or  NULL  if
       they fail.  Those that return an	integer, return	-1 for error, non-neg-
       ative for success.

SEE ALSO
       publib(3), iset(3)

AUTHOR
       Lars Wirzenius (lars.wirzenius@helsinki.fi)

Publib			     C Programmer's Manual		     BITARR(3)

NAME | SYNOPSIS | DESCRIPTION | RETURNS | SEE ALSO | AUTHOR

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=ba_and_ba&sektion=3&manpath=FreeBSD+12.0-RELEASE+and+Ports>

home | help