bitv.c File Reference

Routines for managing bit vectors of arbitrary length. More...

#include "common.h"
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <ctype.h>
#include "machine.h"
#include "bu.h"

Include dependency graph for bitv.c:

Go to the source code of this file.

Functions

bu_bitvbu_bitv_new (unsigned int nbits)
 Allocate storage for a new bit vector of at least 'nbits' in length. For efficiency, the bit vector itself is not initialized.
void bu_bitv_free (struct bu_bitv *bv)
 Release all internal storage for this bit vector.
void bu_bitv_clear (struct bu_bitv *bv)
 Set all the bits in the bit vector to zero.
void bu_bitv_or (struct bu_bitv *ov, const struct bu_bitv *iv)
void bu_bitv_and (struct bu_bitv *ov, const struct bu_bitv *iv)
void bu_bitv_vls (struct bu_vls *v, register const struct bu_bitv *bv)
 Print the bits set in a bit vector.
void bu_pr_bitv (const char *str, register const struct bu_bitv *bv)
 Print the bits set in a bit vector. Use bu_vls stuff, to make only a single call to bu_log().
void bu_bitv_to_hex (struct bu_vls *v, register const struct bu_bitv *bv)
 Convert a bit vector to an ascii string of hex digits. The string is from MSB to LSB (bytes and bits).
bu_bitvbu_hex_to_bitv (const char *str)
 Convert a string of HEX digits (as produces by bu_bitv_to_hex) into a bit vector.
bu_bitvbu_bitv_dup (register const struct bu_bitv *bv)
 Make a copy of a bit vector.


Detailed Description

Routines for managing bit vectors of arbitrary length.

The basic type "bitv_t" is defined in h/machine.h; it is the widest integer datatype for which efficient hardware support exists. BITV_SHIFT and BITV_MASK are also defined in machine.h

These bit vectors are "little endian", bit 0 is in the right hand side of the [0] word.

Author:
Michael John Muuss
Source -
The U. S. Army Research Laboratory Aberdeen Proving Ground, Maryland 21005-5068 USA

Definition in file bitv.c.


Generated on Mon Sep 18 01:25:03 2006 for BRL-CAD by  doxygen 1.4.6