GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
BITARR(3) C Programmer's Manual BITARR(3)

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

#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);

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 further 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 returns 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.

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-negative for success.

publib(3), iset(3)

Lars Wirzenius (lars.wirzenius@helsinki.fi)
C Programmer's Manual Publib

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.