compiler.h (3715a540c49335532fb0f75f5b18bc9e269f4471) compiler.h (fd184b9c8003811d797dfc64af6375ecb43cc79d)
1/*
2 * Keep all the ugly #ifdef for system stuff here
3 */
4
5#ifndef __COMPILER_H__
6#define __COMPILER_H__
7
8#include <stddef.h>

--- 38 unchanged lines hidden (view full) ---

47#elif defined(__MACH__) || defined(__FreeBSD__)
48# include <machine/endian.h>
49typedef unsigned long ulong;
50#endif
51#ifdef __FreeBSD__
52# include <sys/endian.h> /* htole32 and friends */
53#elif defined(__OpenBSD__)
54# include <endian.h>
1/*
2 * Keep all the ugly #ifdef for system stuff here
3 */
4
5#ifndef __COMPILER_H__
6#define __COMPILER_H__
7
8#include <stddef.h>

--- 38 unchanged lines hidden (view full) ---

47#elif defined(__MACH__) || defined(__FreeBSD__)
48# include <machine/endian.h>
49typedef unsigned long ulong;
50#endif
51#ifdef __FreeBSD__
52# include <sys/endian.h> /* htole32 and friends */
53#elif defined(__OpenBSD__)
54# include <endian.h>
55# define __BYTE_ORDER BYTE_ORDER
56# define __LITTLE_ENDIAN LITTLE_ENDIAN
57# define __BIG_ENDIAN BIG_ENDIAN
55#endif
56
57#include <time.h>
58
59typedef uint8_t __u8;
60typedef uint16_t __u16;
61typedef uint32_t __u32;
62typedef unsigned int uint;

--- 16 unchanged lines hidden (view full) ---

79 (((x) & 0x000000000000ff00##sfx) << 40) | \
80 (((x) & 0x00000000000000ff##sfx) << 56))
81#if defined(__GNUC__)
82# define uswap_64(x) _uswap_64(x, ull)
83#else
84# define uswap_64(x) _uswap_64(x, )
85#endif
86
58#endif
59
60#include <time.h>
61
62typedef uint8_t __u8;
63typedef uint16_t __u16;
64typedef uint32_t __u32;
65typedef unsigned int uint;

--- 16 unchanged lines hidden (view full) ---

82 (((x) & 0x000000000000ff00##sfx) << 40) | \
83 (((x) & 0x00000000000000ff##sfx) << 56))
84#if defined(__GNUC__)
85# define uswap_64(x) _uswap_64(x, ull)
86#else
87# define uswap_64(x) _uswap_64(x, )
88#endif
89
87#if defined(__OpenBSD__)
88#define cpu_to_le16(x) htole16(x)
89#define cpu_to_le32(x) htole32(x)
90#define cpu_to_le64(x) htole64(x)
91#define le16_to_cpu(x) letoh16(x)
92#define le32_to_cpu(x) letoh32(x)
93#define le64_to_cpu(x) letoh64(x)
94#define cpu_to_be16(x) htobe16(x)
95#define cpu_to_be32(x) htobe32(x)
96#define cpu_to_be64(x) htobe64(x)
97#define be16_to_cpu(x) betoh16(x)
98#define be32_to_cpu(x) betoh32(x)
99#define be64_to_cpu(x) betoh64(x)
100#elif __BYTE_ORDER == __LITTLE_ENDIAN
90#if __BYTE_ORDER == __LITTLE_ENDIAN
101# define cpu_to_le16(x) (x)
102# define cpu_to_le32(x) (x)
103# define cpu_to_le64(x) (x)
104# define le16_to_cpu(x) (x)
105# define le32_to_cpu(x) (x)
106# define le64_to_cpu(x) (x)
107# define cpu_to_be16(x) uswap_16(x)
108# define cpu_to_be32(x) uswap_32(x)

--- 51 unchanged lines hidden ---
91# define cpu_to_le16(x) (x)
92# define cpu_to_le32(x) (x)
93# define cpu_to_le64(x) (x)
94# define le16_to_cpu(x) (x)
95# define le32_to_cpu(x) (x)
96# define le64_to_cpu(x) (x)
97# define cpu_to_be16(x) uswap_16(x)
98# define cpu_to_be32(x) uswap_32(x)

--- 51 unchanged lines hidden ---