BSD compatibility for <machine/endian.h>
Introduce <machine/_endian.h> to let target based customization of <machine/endian.h> via * _LITTLE_ENDIAN, * _BIG_ENDIAN, * _PDP_ENDIAN, and * _BYTE_ORDER. defines. Add definitions expected by FreeBSD to <machine/endian.h> like * _QUAD_HIGHWORD, * _QUAD_LOWWORD, * __bswap16(), * __bswap32(), * __bswap64(), * __htonl(), * __htons(), * __ntohl(), and * __ntohs(). Also, if __BSD_VISIBLE * LITTLE_ENDIAN, * BIG_ENDIAN, * PDP_ENDIAN, and * BYTE_ORDER. Targets that define __machine_host_to_from_network_defined in <machine/_endian.h> must provide their own implementation of * __htonl(), * __htons(), * __ntohl(), and * __ntohs(), otherwise a default implementation is provided by <machine/endian.h>. In case of GCC defines to builtins are used. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
This commit is contained in:
committed by
Corinna Vinschen
parent
7a5b452443
commit
76a2110b47
@ -12,14 +12,21 @@ details. */
|
||||
#define _ENDIAN_H_
|
||||
|
||||
#include <sys/config.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <bits/endian.h>
|
||||
#include <machine/endian.h>
|
||||
|
||||
/*#ifdef __USE_BSD*/
|
||||
# define LITTLE_ENDIAN __LITTLE_ENDIAN
|
||||
# define BIG_ENDIAN __BIG_ENDIAN
|
||||
# define PDP_ENDIAN __PDP_ENDIAN
|
||||
# define BYTE_ORDER __BYTE_ORDER
|
||||
# ifndef LITTLE_ENDIAN
|
||||
# define LITTLE_ENDIAN __LITTLE_ENDIAN
|
||||
# endif
|
||||
# ifndef BIG_ENDIAN
|
||||
# define BIG_ENDIAN __BIG_ENDIAN
|
||||
# endif
|
||||
# ifndef PDP_ENDIAN
|
||||
# define PDP_ENDIAN __PDP_ENDIAN
|
||||
# endif
|
||||
# ifndef BYTE_ORDER
|
||||
# define BYTE_ORDER __BYTE_ORDER
|
||||
# endif
|
||||
/*#endif*/
|
||||
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
|
Reference in New Issue
Block a user