src/lib/misc.h
author Tero Marttila <terom@fixme.fi>
Sat, 29 Nov 2008 01:30:43 +0200
branchnew-evsql
changeset 49 bb2ff0d2d343
parent 28 e944453ca924
permissions -rw-r--r--
modify stat-returning dbfs result functions to use new evsql
#ifndef LIB_UTIL_H
#define LIB_UTIL_H

#include <string.h>
#include <arpa/inet.h>

/*
 * Initialize the given *value* with zeros
 */
#define ZINIT(obj) memset(&(obj), 0, sizeof((obj)))

/*
 * 64-bit hton{s,l,q}
 */
#ifndef WORDS_BIGENDIAN /* i.e. if (little endian) */
#define htonq(x) (((uint64_t)htonl((x)>>32))|(((uint64_t)htonl(x))<<32))
#define ntohq(x) htonq(x)
#else
#define htonq(x) ((uint64_t)(x))
#define ntohq(x) ((uint64_t)(x))
#endif


#endif /* LIB_UTIL_H */