diff --git a/BaseLib/SystemTools.h b/BaseLib/SystemTools.h new file mode 100644 index 0000000000000000000000000000000000000000..c5827203105fd8c1bb31c28560bf62fc81f20ecf --- /dev/null +++ b/BaseLib/SystemTools.h @@ -0,0 +1,29 @@ +/** + * Copyright (c) 2012, OpenGeoSys Community (http://www.opengeosys.com) + * Distributed under a Modified BSD License. + * See accompanying file LICENSE.txt or + * http://www.opengeosys.com/LICENSE.txt + * + * + * \file SystemTools.h + * + * Created on 2012-07-16 by Norihiro Watanabe + */ + +#pragma once + + +namespace BaseLib +{ + +/// return if this system supports little endian or not +inline bool IsLittleEndian() +{ + int x = 0x00000001; + if (*(char*)&x) + return true; //am little + else + return false; //am big +} + +}