| author | Tero Marttila <terom@fixme.fi> |
| Sat, 29 Nov 2008 01:12:00 +0200 | |
| branch | new-evsql |
| changeset 48 | 8b019d191353 |
| parent 28 | e944453ca924 |
| permissions | -rw-r--r-- |
|
6
d2036d7799fd
new 'simple' module, plus hello_simple
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
1 |
#ifndef LIB_UTIL_H |
|
d2036d7799fd
new 'simple' module, plus hello_simple
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
2 |
#define LIB_UTIL_H |
|
d2036d7799fd
new 'simple' module, plus hello_simple
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
3 |
|
|
28
e944453ca924
split off dbfs components into a separate dir, improve dirop docs, error handling, etc
Tero Marttila <terom@fixme.fi>
parents:
24
diff
changeset
|
4 |
#include <string.h> |
| 24 | 5 |
#include <arpa/inet.h> |
6 |
||
|
6
d2036d7799fd
new 'simple' module, plus hello_simple
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
7 |
/* |
|
d2036d7799fd
new 'simple' module, plus hello_simple
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
8 |
* Initialize the given *value* with zeros |
|
d2036d7799fd
new 'simple' module, plus hello_simple
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
9 |
*/ |
|
d2036d7799fd
new 'simple' module, plus hello_simple
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
10 |
#define ZINIT(obj) memset(&(obj), 0, sizeof((obj))) |
|
d2036d7799fd
new 'simple' module, plus hello_simple
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
11 |
|
| 24 | 12 |
/* |
13 |
* 64-bit hton{s,l,q}
|
|
14 |
*/ |
|
15 |
#ifndef WORDS_BIGENDIAN /* i.e. if (little endian) */ |
|
16 |
#define htonq(x) (((uint64_t)htonl((x)>>32))|(((uint64_t)htonl(x))<<32)) |
|
17 |
#define ntohq(x) htonq(x) |
|
18 |
#else |
|
19 |
#define htonq(x) ((uint64_t)(x)) |
|
20 |
#define ntohq(x) ((uint64_t)(x)) |
|
21 |
#endif |
|
22 |
||
23 |
||
|
6
d2036d7799fd
new 'simple' module, plus hello_simple
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
24 |
#endif /* LIB_UTIL_H */ |
|
d2036d7799fd
new 'simple' module, plus hello_simple
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
25 |