2006-02-08 21:56:14 +03:00
|
|
|
#ifndef COMPAT_H_
|
|
|
|
#define COMPAT_H_
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
2006-03-28 02:26:28 +04:00
|
|
|
#ifdef HAVE_ASM_BYTEORDER_H
|
|
|
|
#include <asm/byteorder.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_SYS_BYTEORDER_H
|
|
|
|
# include <sys/byteorder.h>
|
|
|
|
# if defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN)
|
|
|
|
# undef _BIG_ENDIAN
|
|
|
|
# define _BIG_ENDIAN 4321
|
|
|
|
# define _BYTE_ORDER _BIG_ENDIAN
|
|
|
|
# elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)
|
|
|
|
# undef _LITTLE_ENDIAN
|
|
|
|
# define _LITTLE_ENDIAN 1234
|
|
|
|
# define _BYTE_ORDER _LITTLE_ENDIAN
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_BYTESWAP_H
|
|
|
|
#include <byteswap.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_MACHINE_ENDIAN_H
|
|
|
|
#include <machine/endian.h>
|
|
|
|
#endif
|
|
|
|
|
2006-02-08 21:56:14 +03:00
|
|
|
#ifndef HAVE_STRLCPY
|
|
|
|
size_t strlcpy(char *, const char *, size_t);
|
|
|
|
#endif
|
|
|
|
|
2006-03-20 23:45:07 +03:00
|
|
|
#ifndef __UNCONST
|
|
|
|
#define __UNCONST(a) ((void *)(unsigned long)(const void *)(a))
|
2006-02-08 21:56:14 +03:00
|
|
|
#endif
|
2006-03-20 23:45:07 +03:00
|
|
|
|
|
|
|
#ifndef HTOBE64
|
|
|
|
# if _BYTE_ORDER == _BIG_ENDIAN
|
2006-03-29 00:03:30 +04:00
|
|
|
# define HTOBE64(x) (x)
|
2006-03-20 23:45:07 +03:00
|
|
|
# else /* LITTLE_ENDIAN */
|
|
|
|
# define HTOBE64(x) (x) = __bswap64((u_int64_t)(x))
|
|
|
|
# define bswap64(x) __bswap64(x)
|
|
|
|
# endif /* LITTLE_ENDIAN */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef BE64TOH
|
|
|
|
#define BE64TOH(x) HTOBE64(x)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _DIAGASSERT
|
|
|
|
# ifndef __static_cast
|
|
|
|
# define __static_cast(x,y) (x)y
|
|
|
|
# endif
|
|
|
|
#define _DIAGASSERT(e) (__static_cast(void,0))
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* COMPAT_H_ */
|