ZEDA  1.6.18
Macros | Functions
bit operations.

Macros

#define printf_bit(v, w)   fprintf_bit( stdout, (v), (w) )
 output a bit sequence to the standard output. More...
 

Functions

ulong bit_rotate (ulong val, int bitwidth, int d)
 rotate a bit sequence. More...
 
ulong bit_reverse (ulong val, int bitwidth)
 reverse a bit sequence. More...
 
void sprintf_bit (char *str, ulong val, int width)
 convert a bit sequence to a string in binary format. More...
 
void fprintf_bit (FILE *fp, ulong val, int width)
 output a bit sequence to a file in binary format. More...
 

Detailed Description

Macro Definition Documentation

◆ printf_bit

#define printf_bit (   v,
 
)    fprintf_bit( stdout, (v), (w) )

output a bit sequence to the standard output.

Function Documentation

◆ bit_rotate()

ulong bit_rotate ( ulong  val,
int  bitwidth,
int  d 
)

rotate a bit sequence.

bit_rotate() rotates a bit sequence of a value val with the bit width bitwidth. d is a rotation displacement.

Returns
the value converted.

◆ bit_reverse()

ulong bit_reverse ( ulong  val,
int  bitwidth 
)

reverse a bit sequence.

bit_reverse() reverses a bit sequence val with the bit width bitwidth.

Returns
the value converted.

◆ sprintf_bit()

void sprintf_bit ( char *  str,
ulong  val,
int  width 
)

convert a bit sequence to a string in binary format.

sprintf_bit() converts a given value val to a string in binary format. The string is stored where a pointer str points. width is the applied bit width. For example, sprintf_bit( str, 0xf, 6 ) makes str "001111".

Note
The size of str has to be more than width + 1 bytes.
See also
fprintf_bit

◆ fprintf_bit()

void fprintf_bit ( FILE *  fp,
ulong  val,
int  width 
)

output a bit sequence to a file in binary format.

fprintf_bit() outputs a given value val to the current position of a file pointed by fp. The output format is the same with that of sprintf_bit().

Note
fprintf_bit() is not available in the kernel space.