Collaboration diagram for Bit Vectors:
![]() |
Files | |
file | bitv.c |
Routines for managing bit vectors of arbitrary length. | |
file | printb.c |
print bitfields | |
Data Structures | |
struct | bu_bitv |
Bit vector data structure. More... | |
Defines | |
#define | BU_BITV_MAGIC 0x62697476 |
#define | BU_CK_BITV(_vp) BU_CKMAG(_vp, BU_BITV_MAGIC, "bu_bitv") |
#define | BU_BITS2BYTES(_nb) (BU_BITS2WORDS(_nb)*sizeof(bitv_t)) |
#define | BU_BITS2WORDS(_nb) (((_nb)+BITV_MASK)>>BITV_SHIFT) |
#define | BU_WORDS2BITS(_nw) ((_nw)*sizeof(bitv_t)*8) |
#define | BU_BITTEST(_bv, bit) (((_bv)->bits[(bit)>>BITV_SHIFT] & (((bitv_t)1)<<((bit)&BITV_MASK)))!=0) |
#define | BU_BITSET(_bv, bit) ((_bv)->bits[(bit)>>BITV_SHIFT] |= (((bitv_t)1)<<((bit)&BITV_MASK))) |
#define | BU_BITCLR(_bv, bit) ((_bv)->bits[(bit)>>BITV_SHIFT] &= ~(((bitv_t)1)<<((bit)&BITV_MASK))) |
#define | BU_BITV_ZEROALL(_bv) { memset( (char *)((_bv)->bits), 0, BU_BITS2BYTES( (_bv)->nbits ) ); } |
#define | BU_BITV_BITNUM_CHECK(_bv, _bit) |
#define | BU_BITV_NBITS_CHECK(_bv, _nbits) |
#define | BU_BITV_LOOP_START(_bv) |
#define | BU_BITV_LOOP_INDEX ((_wd << BITV_SHIFT) | _b) |
#define | BU_BITV_LOOP_END |
Functions | |
bu_bitv * | bu_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_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, const struct bu_bitv *bv) |
void | bu_pr_bitv (const char *str, const struct bu_bitv *bv) |
void | bu_bitv_to_hex (struct bu_vls *v, const struct bu_bitv *bv) |
bu_bitv * | bu_hex_to_bitv (const char *str) |
Convert a string of HEX digits (as produces by bu_bitv_to_hex) into a bit vector. | |
bu_bitv * | bu_bitv_dup (const struct bu_bitv *bv) |
void | bu_bitv_free (struct bu_bitv *bv) |
Release all internal storage for this bit vector. | |
void | bu_vls_printb (struct bu_vls *vls, const char *s, unsigned long v, const char *bits) |
void | bu_printb (const char *s, unsigned long v, const char *bits) |
void | bu_ptbl_init (struct bu_ptbl *b, int len, const char *str) |
void | bu_ptbl_reset (struct bu_ptbl *b) |
int | bu_ptbl_ins (struct bu_ptbl *b, long *p) |
int | bu_ptbl_locate (const struct bu_ptbl *b, const long *p) |
void | bu_ptbl_zero (struct bu_ptbl *b, const long *p) |
int | bu_ptbl_ins_unique (struct bu_ptbl *b, long *p) |
int | bu_ptbl_rm (struct bu_ptbl *b, const long *p) |
void | bu_ptbl_cat (struct bu_ptbl *dest, const struct bu_ptbl *src) |
void | bu_ptbl_cat_uniq (struct bu_ptbl *dest, const struct bu_ptbl *src) |
void | bu_ptbl_free (struct bu_ptbl *b) |
int | bu_ptbl (struct bu_ptbl *b, int func, long *p) |
void | bu_pr_ptbl (const char *title, const struct bu_ptbl *tbl, int verbose) |
void | bu_ptbl_trunc (struct bu_ptbl *tbl, int end) |
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_bitv * | bu_bitv_dup (register const struct bu_bitv *bv) |
Make a copy of a bit vector. | |
void | bu_vls_printb (struct bu_vls *vls, const char *s, register long unsigned int v, register const char *bits) |
void | bu_printb (const char *s, register long unsigned int v, register const char *bits) |
|
Definition at line 847 of file bu.h. Referenced by bu_bitv_new(), and bu_identify_magic(). |
|
Definition at line 848 of file bu.h. Referenced by bu_bitv_clear(), bu_bitv_free(), bu_bitv_to_hex(), bu_bitv_vls(), bu_pr_bitv(), get_solidbitv(), rt_bool_partition_eligible(), rt_boolfinal(), rt_clean_resource(), and rt_tree_test_ready(). |
|
Definition at line 854 of file bu.h. Referenced by bu_bitv_new(). |
|
Definition at line 855 of file bu.h. Referenced by bu_bitv_and(), and bu_bitv_or(). |
|
|
|
Definition at line 859 of file bu.h. Referenced by bu_bitv_vls(), rt_find_backing_dist(), rt_shootray(), rt_shootray_bundle(), and rt_tree_test_ready(). |
|
Definition at line 874 of file bu.h. Referenced by rt_bot_tcladjust(), rt_find_backing_dist(), rt_shootray(), and rt_shootray_bundle(). |
|
Definition at line 876 of file bu.h. Referenced by rt_bot_tcladjust(). |
|
Definition at line 878 of file bu.h. Referenced by bu_bitv_clear(), and rt_shootray(). |
|
Value: |
|
Value: |
|
Value: { \ register int _wd; /* Current word number */ \ BU_CK_BITV(_bv); \ for( _wd=BU_BITS2WORDS((_bv)->nbits)-1; _wd>=0; _wd-- ) { \ register int _b; /* Current bit-in-word number */ \ register bitv_t _val; /* Current word value */ \ if((_val = (_bv)->bits[_wd])==0) continue; \ for(_b=0; _b < BITV_MASK+1; _b++, _val >>= 1 ) { \ if( !(_val & 1) ) continue;
|
|
This macro is valid only between a BU_BITV_LOOP_START/LOOP_END pair, and gives the bit number of the current iteration. |
|
Value: } /* end for(_b) */ \ } /* end for(_wd) */ \ } |
|
Allocate storage for a new bit vector of at least 'nbits' in length. For efficiency, the bit vector itself is not initialized. B U _ B I T V _ N E W Definition at line 67 of file bitv.c. References BU_BITS2BYTES, BU_BITV_MAGIC, BU_LIST_INIT, bu_malloc(), bu_bitv::l, bu_list::magic, and bu_bitv::nbits. Referenced by bu_bitv_dup(), bu_hex_to_bitv(), get_solidbitv(), rt_bot_export(), and rt_res_pieces_init(). Here is the call graph for this function: ![]() |
|
Set all the bits in the bit vector to zero. B U _ B I T V _ C L E A R Also available as a macro if you don't desire the pointer checking. Definition at line 108 of file bitv.c. References BU_BITV_ZEROALL, and BU_CK_BITV. Referenced by bu_bitv_dup(), bu_hex_to_bitv(), rt_bot_export(), rt_find_backing_dist(), rt_shootray(), and rt_shootray_bundle(). |
|
B U _ B I T V _ O R Definition at line 119 of file bitv.c. References bu_bitv::bits, BU_BITS2WORDS, bu_bomb(), and bu_bitv::nbits. Referenced by bu_bitv_dup(). Here is the call graph for this function: ![]() |
|
Definition at line 143 of file bitv.c. References bu_bitv::bits, BU_BITS2WORDS, bu_bomb(), and bu_bitv::nbits. Here is the call graph for this function: ![]() |
|
Referenced by bu_pr_bitv(). |
|
|
|
Referenced by rt_bot_export(), rt_bot_export5(), and rt_bot_tclget(). |
|
Convert a string of HEX digits (as produces by bu_bitv_to_hex) into a bit vector. B U _ H E X _ T O _ B I T V Definition at line 247 of file bitv.c. References bu_bitv::bits, bu_bitv_clear(), bu_bitv_new(), bu_log(), and NULL. Referenced by rt_bot_tcladjust(). Here is the call graph for this function: ![]() |
|
Referenced by rt_bot_xform(), and XGLUE(). |
|
Release all internal storage for this bit vector. B U _ B I T V _ F R E E It is the caller's responsibility to not use the pointer 'bv' any longer. It is the caller's responsibility to dequeue from any linked list first. Definition at line 92 of file bitv.c. References bu_list::back, BU_CK_BITV, bu_free(), BU_LIST_NULL, bu_list::forw, and bu_bitv::l. Referenced by rt_res_pieces_clean(). Here is the call graph for this function: ![]() |
|
Referenced by bu_printb(), and bu_tcl_printb(). |
|
Referenced by db_pr_tree_state(). |
|
|
B U _ P T B L _ R E S E T Reset the table to have no elements, but retain any existing storage. Definition at line 91 of file ptbl.c. References bu_ptbl::blen, BU_CK_PTBL, bu_debug, BU_DEBUG_PTBL, bu_log(), bu_ptbl::buffer, and bu_ptbl::end. Referenced by bu_ptbl(), dgo_E_cmd(), nmg_decompose_shell(), nmg_fix_overlapping_loops(), nmg_intersect_loops_self(), nmg_move_edge_thru_pt(), nmg_split_loops_handler(), and rt_shootray(). Here is the call graph for this function: ![]() |
|
|
Referenced by bu_ptbl(), nmg_ck_vu_ptbl(), nmg_enlist_one_vu(), nmg_enlist_vu(), nmg_fix_normals(), nmg_follow_free_edges_to_vertex(), and rt_nmg_tclget(). |
|
Referenced by bu_ptbl(), nmg_edge_collapse(), and nmg_model_edge_fuse(). |
|
|
Referenced by bu_ptbl(), db_close_client(), nmg_break_edge_at_verts(), nmg_follow_free_edges_to_vertex(), nmg_kill_anti_loops(), nmg_pop_eu(), nmg_ptbl_vfuse(), and rt_shootray(). |
|
B U _ P T B L _ C A T Catenate one table onto end of another. There is no checking for duplication. Definition at line 271 of file ptbl.c. References bcopy, bu_ptbl::blen, BU_CK_PTBL, bu_debug, BU_DEBUG_PTBL, bu_log(), bu_realloc(), bu_ptbl::buffer, and bu_ptbl::end. Referenced by bu_ptbl(). Here is the call graph for this function: ![]() |
|
B U _ P T B L _ C A T _ U N I Q Catenate one table onto end of another, ensuring that no entry is duplicated. Duplications between multiple items in 'src' are not caught. The search is a nasty n**2 one. The tables are expected to be short. Definition at line 299 of file ptbl.c. References bu_ptbl::blen, BU_CK_PTBL, bu_debug, BU_DEBUG_PTBL, bu_log(), BU_PTBL_FOR, bu_ptbl_ins_unique(), bu_realloc(), bu_ptbl::buffer, and bu_ptbl::end. Referenced by rt_rebuild_overlaps(). Here is the call graph for this function: ![]() |
|
|
|
|
B U _ P R _ P T B L Print a bu_ptbl array for inspection. Definition at line 385 of file ptbl.c. References BU_CK_PTBL, bu_log(), BU_PTBL_BASEADDR, BU_PTBL_LASTADDR, and bu_ptbl::end. Referenced by rt_pr_soltab(), and rt_prep_parallel(). Here is the call graph for this function: ![]() |
|
B U _ P T B L _ T R U N C truncate a bu_ptbl Definition at line 414 of file ptbl.c. References BU_CK_PTBL, and bu_ptbl::end. Referenced by rt_comb_import5(), and rt_rebuild_overlaps(). |
|
Print the bits set in a bit vector. B U _ B I T V _ V L S Definition at line 169 of file bitv.c. References BU_BITTEST, BU_CK_BITV, BU_CK_VLS, bu_vls_printf(), and bu_vls_strcat(). Here is the call graph for this function: ![]() |
|
Print the bits set in a bit vector. Use bu_vls stuff, to make only a single call to bu_log(). B U _ P R _ B I T V Definition at line 199 of file bitv.c. References bu_bitv_vls(), BU_CK_BITV, bu_log(), bu_vls_addr(), bu_vls_free(), bu_vls_init(), and bu_vls_strcat(). Here is the call graph for this function: ![]() |
|
Convert a bit vector to an ascii string of hex digits. The string is from MSB to LSB (bytes and bits). B U _ B I T V _ T O _ H E X Definition at line 219 of file bitv.c. References BU_CK_BITV, BU_CK_VLS, bu_vls_extend(), and bu_vls_printf(). Here is the call graph for this function: ![]() |
|
Make a copy of a bit vector. B U _ B I T V _ D U P Definition at line 314 of file bitv.c. References bu_bitv_clear(), bu_bitv_new(), and bu_bitv_or(). Here is the call graph for this function: ![]() |
|
B U _ V L S _ P R I N T B Format a value a la the b format of the kernel's printf
Definition at line 66 of file printb.c. References bu_vls_printf(), and bu_vls_strcat(). Here is the call graph for this function: ![]() |
|
B U _ P R I N T B Format and print, like bu_vls_printb(). Definition at line 95 of file printb.c. References bu_log(), bu_vls_addr(), bu_vls_free(), bu_vls_init(), and bu_vls_printb(). Here is the call graph for this function: ![]() |