cu/word.h: Functions on Machine Words
[Data Types]

Functions

cu_word_t cu_word_dcover (cu_word_t x)
cu_word_t cu_word_ucover (unsigned long x)
cu_word_t cu_word_exp2_ceil_log2 (cu_word_t x)
cu_word_t cu_word_bit_count (cu_word_t x)
unsigned int cu_word_floor_log2 (cu_word_t x)
unsigned int cu_word_log2_lowbit (cu_word_t x)
int cu_word_rcmp (cu_word_t w0, cu_word_t w1)
cu_word_t cu_word_bitimg (cu_bool1f_t f, cu_word_t x)
cu_word_t cu_word_bitimg2 (cu_bool2f_t f, cu_word_t x, cu_word_t y)

Detailed Description

The following is a collection of functions on unsigned integers of the native word size. This may be useful when dealing with data which can be processed in chunks of a fixed number of bits, such as bit arrays. For higher level algorithms, the integer variants may be more suitable.

See also:
cu/int.h: Integer Functions
cu/size.h: Functions on Sizes and Pointer Diffs
cu_wordarr_h

Function Documentation

cu_word_t cu_word_bit_count ( cu_word_t  x  ) 

Returns the number of high bits in x.

cu_word_t cu_word_bitimg ( cu_bool1f_t  f,
cu_word_t  x 
)

The bitwise image of x under f. That is, the word where bit number i is the result of applying f to bit number i of x.

cu_word_t cu_word_bitimg2 ( cu_bool2f_t  f,
cu_word_t  x,
cu_word_t  y 
)

The image under f of pairs of bits drawn from respective positions of x and y.

cu_word_t cu_word_dcover ( cu_word_t  x  ) 

Returns a bitmask from the uppermost non-zero bit in x and downwards.

cu_word_t cu_word_exp2_ceil_log2 ( cu_word_t  x  ) 

Returns 2⌈log2 x.

unsigned int cu_word_floor_log2 ( cu_word_t  x  ) 

Returns the exponent of the uppermost non-zero bit in x, that is ⌊log2 x⌋.

unsigned int cu_word_log2_lowbit ( cu_word_t  x  ) 

Returns the exponent of the lowermost non-zero bit in x.

int cu_word_rcmp ( cu_word_t  w0,
cu_word_t  w1 
)

Returns -1, 0, or 1 if after reversing the bits w0 is less, equal, or greater than w1, respectively.

cu_word_t cu_word_ucover ( unsigned long  x  ) 

Returns a bitmask from the lowermost non-zero bit in x and upwards.

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