2 * Endianess conversion for int and short types
4 #define BE32_TO_LE32(val) ({typeof (val) v= (val); \
5 (v>>24) | ((v>>8)&0xFF00) | (v<<24) | ((v<<8)&0xFF0000); } )
6 #define BE16_TO_LE16(val) ({typeof (val) v= (val); (v>>8) | (v<<8); } )
8 * Define a protected, right typed, no side effects macro for min
10 #define min(x, y) ({typeof (x) x_ = (x); typeof (y) y_ = (y); \
13 * debugging print definition
15 #define report(fmt, args...) printf(fmt,##args)
16 #ifdef DEBUG /* done only on debugging */
19 #define debug(fmt, arg...)
24 * Just to print an hex dump of a buffer,
25 * ptr is the address, m is how many word per line
26 * and l how many lines
28 #define PRINT_BUF(ptr, l, m) ({ \
30 unsigned short *_ptr= (unsigned short *)(ptr); \
31 for (_i = 0; _i< (int) l; _i++) { \
32 printf("Val[%d]=", m * _i); \
33 for (_j = 0; _j < (int) m; _j++) { \
34 printf("%x ", *_ptr);\