Go to the documentation of this file.
92 #define SP_LITTLE_ENDIAN
95 #if !defined(SP_BIG_ENDIAN) && !defined(SP_LITTLE_ENDIAN)
100 #if defined(__i386__) || defined(__i386) || defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(__i686__) || defined(__i686)
101 # if defined(SP_BIG_ENDIAN)
102 # undef SP_BIG_ENDIAN
104 # define SP_LITTLE_ENDIAN
110 #if defined(__alpha__) || defined(__alpha)
111 # if defined(SP_LITTLE_ENDIAN)
112 # undef SP_LITTLE_ENDIAN
114 # define SP_BIG_ENDIAN
120 #if defined(__sparc__) || defined(__sparc)
121 # if defined(SP_LITTLE_ENDIAN)
122 # undef SP_LITTLE_ENDIAN
124 # define SP_BIG_ENDIAN
130 #if defined(__ppc__) || defined(__ppc)
131 # if defined(SP_LITTLE_ENDIAN)
132 # undef SP_LITTLE_ENDIAN
134 # define SP_BIG_ENDIAN
138 #if defined(__LITTLE_ENDIAN__) || defined(__LITTLEENDIAN__)
139 # define SP_LITTLE_ENDIAN
142 #if defined(__BIG_ENDIAN__) || defined(__BIGENDIAN__)
143 # define SP_BIG_ENDIAN
146 #if defined(SP_BIG_ENDIAN) && defined(SP_LITTLE_ENDIAN)
147 # error Both BIG and LITTLE endian defined. Fix os.h and/or Makefile
150 #if !defined(SP_BIG_ENDIAN) && !defined(SP_LITTLE_ENDIAN)
151 # error Neither BIG nor LITTLE endian defined. Fix os.h and/or Makefile
162 #if defined(__i386__) || defined(__i386) || defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(__i686__) || defined(__i686)
178 #define iswap_int8(x) \
179 (((x & 0x00000000000000ffLL) << 56) + \
180 ((x & 0x000000000000ff00LL) << 40) + \
181 ((x & 0x0000000000ff0000LL) << 24) + \
182 ((x & 0x00000000ff000000LL) << 8) + \
183 ((x & 0x000000ff00000000LL) >> 8) + \
184 ((x & 0x0000ff0000000000LL) >> 24) + \
185 ((x & 0x00ff000000000000LL) >> 40) + \
186 ((x & 0xff00000000000000LL) >> 56))
188 #define iswap_int4(x) \
189 (((x & 0x000000ff) << 24) + \
190 ((x & 0x0000ff00) << 8) + \
191 ((x & 0x00ff0000) >> 8) + \
192 ((x & 0xff000000) >> 24))
194 #define iswap_int2(x) \
195 (((x & 0x00ff) << 8) + \
204 #if defined(__linux__)
205 # include <byteswap.h>
209 # define iswap_int8 bswap_64
210 # define iswap_int4 bswap_32
211 # define iswap_int2 bswap_16
227 #define le_int4(x) iswap_int4((x))
230 #ifdef SP_LITTLE_ENDIAN
231 #define le_int4(x) (x)
239 #define __PRI64__ "l"
240 #define PRId64 __PRI64__ "d"
244 #define PRIu64 __PRI64__ "u"
259 #if defined(__sun__) && !defined(__svr4__)
269 #if defined(_MSC_VER)
271 #define pclose _pclose
272 #define ftruncate(fd,len) _chsize(fd,len)
279 #if defined(__MINGW32__)
281 #define sysconf(x) 512
282 #define ftruncate(fd,len) _chsize(fd,len)
288 # if __MSVCRT_VERSION__ >= 0x800
290 # define off_t __int64
291 # define fseeko _fseeki64
292 # define ftello _ftelli64
296 # define fseeko fseek
297 # define ftello ftell