1 /**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2001-2009 Vivid Solutions Inc.
7 *
8 * This is free software; you can redistribute and/or modify it under
9 * the terms of the GNU Lesser General Public Licence as published
10 * by the Free Software Foundation.
11 * See the COPYING file for more information.
12 *
13 **********************************************************************/
14 #ifndef GEOS_UTIL_MACHINE_H_INCLUDED
15 #define GEOS_UTIL_MACHINE_H_INCLUDED
16
17 /**
18 * Check endianness of current machine.
19 * @return 0 for big_endian | xdr; 1 == little_endian | ndr
20 */
21 inline int
getMachineByteOrder()22 getMachineByteOrder()
23 {
24 static int endian_check = 1; // don't modify !!
25 return *((char*)&endian_check);
26 }
27
28 #endif
29