cucon/bitarray.h: Array of Bits
[Linear Containers (lists, stacks, arrays)]

Data Structures

struct  cucon_bitarray

Functions

void cucon_bitarray_init (cucon_bitarray_t ba, size_t size)
cucon_bitarray_t cucon_bitarray_new (size_t size)
void cucon_bitarray_init_fill (cucon_bitarray_t ba, size_t size, cu_bool_t val)
cucon_bitarray_t cucon_bitarray_new_fill (size_t size, cu_bool_t val)
void cucon_bitarray_init_copy (cucon_bitarray_t ba, cucon_bitarray_t ba_src)
cucon_bitarray_t cucon_bitarray_new_copy (cucon_bitarray_t ba_src)
void cucon_bitarray_swap (cucon_bitarray_t ba0, cucon_bitarray_t ba1)
void cucon_bitarray_fill (cucon_bitarray_t ba, size_t low, size_t high, cu_bool_t val)
size_t cucon_bitarray_size (cucon_bitarray_t ba)
int cucon_bitarray_cmp (cucon_bitarray_t ba0, cucon_bitarray_t ba1)
cu_bool_t cucon_bitarray_eq (cucon_bitarray_t ba0, cucon_bitarray_t ba1)
void cucon_bitarray_set_at (cucon_bitarray_t ba, size_t i, cu_bool_t value)
cu_bool_t cucon_bitarray_at (cucon_bitarray_t ba, size_t i)
size_t cucon_bitarray_find (cucon_bitarray_t ba, size_t start, cu_bool_t value)
size_t cucon_bitarray_find2 (cucon_bitarray_t ba0, cucon_bitarray_t ba1, size_t start, cu_bool_t val0, cu_bool_t val1)
void cucon_bitarray_resize_gp (cucon_bitarray_t ba, size_t size)
void cucon_bitarray_resize_gpmax (cucon_bitarray_t ba, size_t size)
void cucon_bitarray_resize_exact (cucon_bitarray_t ba, size_t size)
void cucon_bitarray_resize_exactmax (cucon_bitarray_t ba, size_t size)
void cucon_bitarray_resize_fill_gp (cucon_bitarray_t ba, size_t size, cu_bool_t fill_value)
void cucon_bitarray_resize_fill_exact (cucon_bitarray_t ba, size_t size, cu_bool_t fill_value)
void cucon_bitarray_resize_set_at (cucon_bitarray_t ba, size_t i, cu_bool_t fill_value, cu_bool_t set_value)
void cucon_bitarray_init_img_bool1f (cu_bool1f_t f, cucon_bitarray_t ba, cucon_bitarray_t arg)
void cucon_bitarray_init_img_bool2f (cu_bool2f_t f, cucon_bitarray_t ba, cucon_bitarray_t arg0, cucon_bitarray_t arg1)
cucon_bitarray_t cucon_bitarray_img_bool1f (cu_bool1f_t f, cucon_bitarray_t arg)
cucon_bitarray_t cucon_bitarray_img_bool2f (cu_bool2f_t f, cucon_bitarray_t arg0, cucon_bitarray_t arg1)
void cucon_bitarray_update_img_bool1f (cu_bool1f_t f, cucon_bitarray_t ba)
void cucon_bitarray_update_img_bool2f (cu_bool2f_t f, cucon_bitarray_t ba, cucon_bitarray_t arg1)

Detailed Description

The following implements a compact, mutable, and resizable array of booleans with an API similar to that of cucon/array.h and cucon/parray.h.

See also:
cucon/bitarray_slice.h: Bitarray Slices
cucon/array.h: Generic Array
cucon/parray.h: Array of Pointers

Function Documentation

cu_bool_t cucon_bitarray_at ( cucon_bitarray_t  ba,
size_t  i 
)

Return element i of ba.

Precondition:
cucon_bitarray_size(ba) >= i
int cucon_bitarray_cmp ( cucon_bitarray_t  ba0,
cucon_bitarray_t  ba1 
)

Returns -1, 0, or 1 if ba0 is less, equal, or greater than ba1, respectively. The lowest positions counts as most significant.

cu_bool_t cucon_bitarray_eq ( cucon_bitarray_t  ba0,
cucon_bitarray_t  ba1 
)

True iff ba0 and ba1 contain the same bits.

void cucon_bitarray_fill ( cucon_bitarray_t  ba,
size_t  low,
size_t  high,
cu_bool_t  val 
)

Set bits [low, high) in ba to val.

size_t cucon_bitarray_find ( cucon_bitarray_t  ba,
size_t  start,
cu_bool_t  value 
)

Return the lowest index greater or equal to start where ba holds value, or -1 if not found.

cucon_bitarray_t cucon_bitarray_img_bool1f ( cu_bool1f_t  f,
cucon_bitarray_t  arg 
)

The image of arg under f as a newly allocated bit array.

cucon_bitarray_t cucon_bitarray_img_bool2f ( cu_bool2f_t  f,
cucon_bitarray_t  arg0,
cucon_bitarray_t  arg1 
)

The image of pairs zipped from arg0 and arg1 under f as a newly allocated bit array.

void cucon_bitarray_init ( cucon_bitarray_t  ba,
size_t  size 
)

Construct an uninitialised vector which can hold size bits.

void cucon_bitarray_init_copy ( cucon_bitarray_t  ba,
cucon_bitarray_t  ba_src 
)

Construct ba as a copy of ba_src.

void cucon_bitarray_init_fill ( cucon_bitarray_t  ba,
size_t  size,
cu_bool_t  val 
)

Construct an vector of size bits initialised to val.

void cucon_bitarray_init_img_bool1f ( cu_bool1f_t  f,
cucon_bitarray_t  ba,
cucon_bitarray_t  arg 
)

Initialise ba to the image of arg under f.

void cucon_bitarray_init_img_bool2f ( cu_bool2f_t  f,
cucon_bitarray_t  ba,
cucon_bitarray_t  arg0,
cucon_bitarray_t  arg1 
)

Initialise ba to the image under f of the pairs zipped from arg0 and arg1.

cucon_bitarray_t cucon_bitarray_new ( size_t  size  ) 

Return an uninitialised vector which can hold size bits.

cucon_bitarray_t cucon_bitarray_new_copy ( cucon_bitarray_t  ba_src  ) 

Return a copy of ba_src.

cucon_bitarray_t cucon_bitarray_new_fill ( size_t  size,
cu_bool_t  val 
)

Return a vector of size bits initialised to val.

void cucon_bitarray_resize_exact ( cucon_bitarray_t  ba,
size_t  size 
)

Resize ba to size, adjusting the capacity to the minimum required for the new size.

void cucon_bitarray_resize_exactmax ( cucon_bitarray_t  ba,
size_t  size 
)

Resize ba to size, increasing the capacity if required, but only to the minimum required. This function does not reduce the capacity.

void cucon_bitarray_resize_fill_exact ( cucon_bitarray_t  ba,
size_t  size,
cu_bool_t  fill_value 
)

Call cucon_bitarray_resize_exact and fill any newly allocated elements with fill_value.

void cucon_bitarray_resize_fill_gp ( cucon_bitarray_t  ba,
size_t  size,
cu_bool_t  fill_value 
)

Call cucon_bitarray_resize_gp and fill any newly allocated elements with fill_value.

void cucon_bitarray_resize_gp ( cucon_bitarray_t  ba,
size_t  size 
)

Resize ba to size, adjusting the capacity in geometric progression as needed.

void cucon_bitarray_resize_gpmax ( cucon_bitarray_t  ba,
size_t  size 
)

Resize ba to size, increasing the capacity in geometric progression as needed. This function does not reduce the capacity.

void cucon_bitarray_resize_set_at ( cucon_bitarray_t  ba,
size_t  i,
cu_bool_t  fill_value,
cu_bool_t  set_value 
)

Set element i of ba to set_value, resizing if necessary and filling undefined elements with fill_value. The resize is done in geometric progression.

void cucon_bitarray_set_at ( cucon_bitarray_t  ba,
size_t  i,
cu_bool_t  value 
)

Set element i of ba to value.

Precondition:
cucon_bitarray_size(ba) >= i
size_t cucon_bitarray_size ( cucon_bitarray_t  ba  ) 

The number of bits in ba.

void cucon_bitarray_swap ( cucon_bitarray_t  ba0,
cucon_bitarray_t  ba1 
)

Swap the contents of ba0 and ba1.

void cucon_bitarray_update_img_bool1f ( cu_bool1f_t  f,
cucon_bitarray_t  ba 
)

Update each element of ba to its image under f.

void cucon_bitarray_update_img_bool2f ( cu_bool2f_t  f,
cucon_bitarray_t  ba,
cucon_bitarray_t  arg1 
)

Update each element of ba to the image under f of pairs of bits formed from corresponding elements of ba and arg1

Generated 2009-11-23 for culibs-0.25 using Doxygen. Maintained by Petter Urkedal.