2 * Automatic configuration file for XTL
4 * Copyright (C) 2000 Asger Nielsen, alstrup@sophusmedical.dk
5 * Copyright (C) 2000 Angus Leeming, a.leeming@ic.ac.uk
6 * Copyright (C) 2000 Jose' Orlando Pereira, jop@di.uminho.pt
8 /* XTL - eXternalization Template Library - http://gsd.di.uminho.pt/~jop/xtl
9 * Copyright (C) 1998-2000 Jose' Orlando Pereira, Universidade do Minho
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Library General Public
13 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version.
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Library General Public License for more details.
21 * You should have received a copy of the GNU Library General Public
22 * License along with this library; if not, write to the Free
23 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
26 * Id: config.h 1.7 Fri, 12 May 2000 18:23:14 +0100 jop
32 #define XTL_CONFIG_CHOICE_MACROS
35 # if __GNUC__ >2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >=95 ) // >= G++ 2.95
36 # define XTL_CONFIG_SIMPLE_CONTAINERS
39 typedef long long longlong;
40 typedef unsigned long long unsignedlonglong;
42 #elif defined (__DECCXX)
43 # define XTL_CONFIG_SIMPLE_CONTAINERS
45 typedef long long int longlong;
46 typedef unsigned long long int unsignedlonglong;
49 # define XTL_CONFIG_SIMPLE_CONTAINERS
51 typedef long long int longlong;
52 typedef unsigned long long int unsignedlonglong;
54 #elif defined (_WIN32)
56 # define XTL_CONFIG_COMPOSITE_BUG
57 # define XTL_CONFIG_LACK_ENDIAN_H
59 typedef __int64 longlong;
60 typedef unsigned __int64 unsignedlonglong;
62 // Disable some stupid warnings
63 # pragma warning(disable:4127 4786 4800)
65 // Work around for broken for-scoping with Visual C++ 6.0
66 # define for if(0);else for
68 // Enable a bunch of useful warnings
69 # pragma warning(3:4019 4032 4057 4061 4125 4130 4152 4189 4201 4706)
73 // Establish __BYTE_ORDER
77 # define __LITTLE_ENDIAN 1234
78 # define __BIG_ENDIAN 4321
81 #if defined(__alpha) || defined(__alpha__)
83 # define __BYTE_ORDER __LITTLE_ENDIAN
88 # define __BYTE_ORDER __BIG_ENDIAN
92 #if ((__BYTE_ORDER != __LITTLE_ENDIAN) && (__BYTE_ORDER != __BIG_ENDIAN))
93 # error "Architecture not supported."
96 // Don't use byteswap.h on Alpha machines because its buggy
97 #if defined(__linux__) && !(defined(__alpha) || defined(__alpha__))
98 # include <byteswap.h>
100 inline unsigned short bswap_16(unsigned short b) {
101 return ((b&0xff00)>>8)|((b&0x00ff)>>8);
104 inline unsigned int bswap_32(unsigned int b) {
105 return ((b&0xff000000)>>24)|((b&0x00ff0000)>>8)|
106 ((b&0x0000ff00)<<8)|((b&0x000000ff)<<24);
109 inline unsignedlonglong bswap_64(unsignedlonglong b) {
110 return ( ((b&0xff00000000000000) >> 56) |
111 ((b&0x00ff000000000000) >> 40) |
112 ((b&0x0000ff0000000000) >> 24) |
113 ((b&0x000000ff00000000) >> 8) |
114 ((b&0x00000000ff000000) << 8) |
115 ((b&0x0000000000ff0000) << 24) |
116 ((b&0x000000000000ff00) << 40) |
117 ((b&0x00000000000000ff) << 56) );
121 // We need this for memcpy
122 #if (defined(__alpha) || defined(__alpha__)) && !defined(__GNUC__)