ReactOS 0.4.15-dev-8058-ga7cbb60
btorder.h
Go to the documentation of this file.
1/* @(#)btorder.h 1.22 12/12/03 Copyright 1996-2012 J. Schilling */
2/*
3 * Definitions for Bit and Byte ordering
4 *
5 * Copyright (c) 1996-2012 J. Schilling
6 */
7/*
8 * The contents of this file are subject to the terms of the
9 * Common Development and Distribution License, Version 1.0 only
10 * (the "License"). You may not use this file except in compliance
11 * with the License.
12 *
13 * See the file CDDL.Schily.txt in this distribution for details.
14 *
15 * When distributing Covered Code, include this CDDL HEADER in each
16 * file and include the License file CDDL.Schily.txt from this distribution.
17 */
18
19
20#ifndef _SCHILY_BTORDER_H
21#define _SCHILY_BTORDER_H
22
23#ifndef _SCHILY_MCONFIG_H
24#include <schily/mconfig.h> /* load bit/byte-oder from xmconfig.h */
25#endif
26
27#ifndef _SCHILY_TYPES_H
28#include <schily/types.h> /* try to load isa_defs.h on Solaris */
29#endif
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35/*
36 * Convert bit-order definitions from xconfig.h into our values
37 * and verify them.
38 */
39#if defined(HAVE_C_BITFIELDS) && \
40 defined(BITFIELDS_LTOH)
41#define _BIT_FIELDS_LTOH
42#endif
43
44#if defined(HAVE_C_BITFIELDS) && \
45 defined(BITFIELDS_HTOL)
46#define _BIT_FIELDS_HTOL
47#endif
48
49#if defined(HAVE_C_BITFIELDS) && \
50 !defined(BITFIELDS_HTOL)
51#define BITFIELDS_LTOH
52#define _BIT_FIELDS_LTOH
53#endif
54
55#if defined(_BIT_FIELDS_LTOH) && defined(_BIT_FIELDS_HTOL)
56/*
57 * #error will not work for all compilers (e.g. sunos4)
58 * The following line will abort compilation on all compilers
59 * if none of the above is defined. And that's what we want.
60 */
61error Only one of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL may be defined
62
63#include <schily/err_bit.h> /* Avoid "unknown directive" with K&R */
64#endif
65
66
67/*
68 * Convert byte-order definitions from xconfig.h into our values
69 * and verify them.
70 * Note that we cannot use the definitions _LITTLE_ENDIAN and _BIG_ENDIAN
71 * because they are used on IRIX-6.5 with different meaning.
72 */
73#if defined(HAVE_C_BIGENDIAN) && \
74 !defined(WORDS_BIGENDIAN)
75#define WORDS_LITTLEENDIAN
76/* #define _LITTLE_ENDIAN */
77#endif
78
79#if defined(HAVE_C_BIGENDIAN) && \
80 defined(WORDS_BIGENDIAN)
81#undef WORDS_LITTLEENDIAN
82/* #define _BIG_ENDIAN */
83#endif
84
85#if defined(_BIT_FIELDS_LTOH) || defined(_BIT_FIELDS_HTOL)
86/*
87 * Bitorder is already known.
88 */
89#else
90/*
91 * Bitorder not yet known.
92 */
93# if defined(sun3) || defined(mc68000) || \
94 defined(sun4) || defined(__sparc) || defined(sparc) || \
95 defined(__hppa) || defined(_ARCH_PPC) || defined(_IBMR2)
96# define _BIT_FIELDS_HTOL
97# endif
98
99# if defined(__sgi) && defined(__mips)
100# define _BIT_FIELDS_HTOL
101# endif
102
103# if defined(__i386__) || defined(__i386) || defined(i386) || \
104 defined(__alpha__) || defined(__alpha) || defined(alpha) || \
105 defined(__arm__) || defined(__arm) || defined(arm)
106# define _BIT_FIELDS_LTOH
107# endif
108
109# if defined(__ppc__) || defined(ppc) || defined(__ppc) || \
110 defined(__PPC) || defined(powerpc) || defined(__powerpc__)
111
112# if defined(__BIG_ENDIAN__)
113# define _BIT_FIELDS_HTOL
114# else
115# define _BIT_FIELDS_LTOH
116# endif
117# endif
118#endif
119
120#ifdef __cplusplus
121}
122#endif
123
124#endif /* _SCHILY_BTORDER_H */
#define error(str)
Definition: mkdosfs.c:1605
int one
Definition: sehframes.cpp:28