1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
|
/*
* Modification History
*
* 2002-May-25 Jason Rohrer
* Created.
*
* 2004-January-12 Jason Rohrer
* Added support for metrowerks win32 compiler.
*
* 2009-April-3 Jason Rohrer
* OpenBSD support.
*/
#include "minorGems/common.h"
/**
* Include this file to define __BYTE_ORDER
*
* After this has been included, __BYTE_ORDER will be either
* __LITTLE_ENDIAN or
* __BIG_ENDIAN
*/
#ifdef __FreeBSD__
#include <machine/endian.h>
#elif defined(__NetBSD__)
#include <sys/endian.h>
#elif defined(__OpenBSD__)
#include <sys/types.h>
#include <machine/endian.h>
// default BSD case
#elif defined(BSD)
#include <machine/endian.h>
#elif defined(SOLARIS)
// Code for Solaris defs adapted from:
// MD5 message-digest algorithm.
// by Colin Plumb in 1993, no copyright is claimed.
//each solaris is different -- this won't work on 2.6 or 2.7
# include <sys/isa_defs.h>
#define __LITTLE_ENDIAN 1234
#define __BIG_ENDIAN 4321
#ifdef _LITTLE_ENDIAN
#define __BYTE_ORDER __LITTLE_ENDIAN
#else // default to big endian
#define __BYTE_ORDER __BIG_ENDIAN
#endif
// end solaris case
#elif defined(WIN_32) || \
( defined(__MWERKS__) && defined(__INTEL__) ) // windows case
#define __LITTLE_ENDIAN 1234
#define __BYTE_ORDER __LITTLE_ENDIAN
// end windows case
#else
// linux case
#include <endian.h>
// end linux case
#endif
// end of all system-specific cases
// BSD calls it BYTE_ORDER, linux calls it __BYTE_ORDER
#ifndef __BYTE_ORDER
#define __BYTE_ORDER BYTE_ORDER
#endif
#ifndef __LITTLE_ENDIAN
#define __LITTLE_ENDIAN LITTLE_ENDIAN
#endif
#ifndef __BIG_ENDIAN
#define __BIG_ENDIAN BIG_ENDIAN
#endif
|