equal
deleted
inserted
replaced
1 #ifndef LIB_UTIL_H |
1 #ifndef LIB_UTIL_H |
2 #define LIB_UTIL_H |
2 #define LIB_UTIL_H |
|
3 |
|
4 #include <arpa/inet.h> |
3 |
5 |
4 /* |
6 /* |
5 * Initialize the given *value* with zeros |
7 * Initialize the given *value* with zeros |
6 */ |
8 */ |
7 #define ZINIT(obj) memset(&(obj), 0, sizeof((obj))) |
9 #define ZINIT(obj) memset(&(obj), 0, sizeof((obj))) |
8 |
10 |
|
11 /* |
|
12 * 64-bit hton{s,l,q} |
|
13 */ |
|
14 #ifndef WORDS_BIGENDIAN /* i.e. if (little endian) */ |
|
15 #define htonq(x) (((uint64_t)htonl((x)>>32))|(((uint64_t)htonl(x))<<32)) |
|
16 #define ntohq(x) htonq(x) |
|
17 #else |
|
18 #define htonq(x) ((uint64_t)(x)) |
|
19 #define ntohq(x) ((uint64_t)(x)) |
|
20 #endif |
|
21 |
|
22 |
9 #endif /* LIB_UTIL_H */ |
23 #endif /* LIB_UTIL_H */ |
10 |
24 |