ZEDA  1.6.18
zeda_bit.h
Go to the documentation of this file.
1 /* ZEDA - Elementary Data and Algorithms
2  * Copyright (C) 1998 Tomomichi Sugihara (Zhidao)
3  */
9 #ifndef __ZEDA_BIT_H__
10 #define __ZEDA_BIT_H__
11 
12 #include <zeda/zeda_misc.h>
13 
15 
16 /* ********************************************************** *//* ************************************************** */
19 
20 /* middle endian not supported. */
21 #define Z_ENDIAN_UNKNOWN 9999
22 #define Z_ENDIAN_LITTLE 1234
23 #define Z_ENDIAN_BIG 4321
24 
36 __EXPORT int endian_check(void);
37 
47 
57 
67 
70 /* ********************************************************** *//* ************************************************** */
73 
81 __EXPORT ulong bit_rotate(ulong val, int bitwidth, int d);
82 
89 __EXPORT ulong bit_reverse(ulong val, int bitwidth);
90 
102 __EXPORT void sprintf_bit(char *str, ulong val, int width);
103 
104 #ifndef __KERNEL__
105 
113 __EXPORT void fprintf_bit(FILE *fp, ulong val, int width);
115 #define printf_bit(v,w) fprintf_bit( stdout, (v), (w) )
116 #else
117 void printk_bit(ulong val, int width);
118 #endif /* __KERNEL__ */
119 
123 
124 #endif /* __ZEDA_BIT_H__ */
ulong bit_reverse(ulong val, int bitwidth)
reverse a bit sequence.
uint16_t endian_reverse16(uint16_t val)
convert 16-bit little/big endian to big/little endian.
void fprintf_bit(FILE *fp, ulong val, int width)
output a bit sequence to a file in binary format.
#define __END_DECLS
Definition: zeda_defs.h:30
void sprintf_bit(char *str, ulong val, int width)
convert a bit sequence to a string in binary format.
miscellanies.
unsigned long long int uint64_t
Definition: zeda_defs.h:68
uint32_t endian_reverse32(uint32_t val)
convert 32-bit little/big endian to big/little endian.
int endian_check(void)
check type of endian of the current architecture.
unsigned short int uint16_t
Definition: zeda_defs.h:63
uint64_t endian_reverse64(uint64_t val)
convert 64-bit little/big endian to big/little endian.
unsigned int uint32_t
Definition: zeda_defs.h:64
#define __BEGIN_DECLS
Definition: zeda_defs.h:26
unsigned long ulong
Definition: zeda_defs.h:105
#define __EXPORT
Definition: zeda_compat.h:32
ulong bit_rotate(ulong val, int bitwidth, int d)
rotate a bit sequence.