X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fio%2Flowlevel.hxx;h=0f650d5b0f27d0372b0395895c484cb9e3da05e2;hb=6a7c2000027cd22eea603e936ddbad1a5bfc8b04;hp=9b75d39f077a90f718b31fd0b44de36a1be5c897;hpb=0a7a815124d15f2f675497aaf60b19237757a00f;p=simgear.git diff --git a/simgear/io/lowlevel.hxx b/simgear/io/lowlevel.hxx index 9b75d39f..0f650d5b 100644 --- a/simgear/io/lowlevel.hxx +++ b/simgear/io/lowlevel.hxx @@ -18,7 +18,7 @@ // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // // $Id$ // @@ -27,19 +27,13 @@ #ifndef _SG_LOWLEVEL_HXX #define _SG_LOWLEVEL_HXX -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include -#ifdef HAVE_STDINT_H -# include -#endif #include #include +#include // Note that output is written in little endian form (and converted as // necessary for big endian machines) @@ -121,52 +115,4 @@ void sgClearWriteError(); int sgReadError(); int sgWriteError(); -inline bool sgIsLittleEndian() { - static const int sgEndianTest = 1; - return (*((char *) &sgEndianTest ) != 0); -} - -inline bool sgIsBigEndian() { - static const int sgEndianTest = 1; - return (*((char *) &sgEndianTest ) == 0); -} - -inline void sgEndianSwap(unsigned short *x) { - *x = - (( *x >> 8 ) & 0x00FF ) | - (( *x << 8 ) & 0xFF00 ) ; -} - -inline void sgEndianSwap(unsigned int *x) { - *x = - (( *x >> 24 ) & 0x000000FF ) | - (( *x >> 8 ) & 0x0000FF00 ) | - (( *x << 8 ) & 0x00FF0000 ) | - (( *x << 24 ) & 0xFF000000 ) ; -} - -inline void sgEndianSwap(uint64_t *x) { -#ifndef _MSC_VER - *x = - (( *x >> 56 ) & 0x00000000000000FFULL ) | - (( *x >> 40 ) & 0x000000000000FF00ULL ) | - (( *x >> 24 ) & 0x0000000000FF0000ULL ) | - (( *x >> 8 ) & 0x00000000FF000000ULL ) | - (( *x << 8 ) & 0x000000FF00000000ULL ) | - (( *x << 24 ) & 0x0000FF0000000000ULL ) | - (( *x << 40 ) & 0x00FF000000000000ULL ) | - (( *x << 56 ) & 0xFF00000000000000ULL ) ; -#else - *x = - (( *x >> 56 ) & 0x00000000000000FF ) | - (( *x >> 40 ) & 0x000000000000FF00 ) | - (( *x >> 24 ) & 0x0000000000FF0000 ) | - (( *x >> 8 ) & 0x00000000FF000000 ) | - (( *x << 8 ) & 0x000000FF00000000 ) | - (( *x << 24 ) & 0x0000FF0000000000 ) | - (( *x << 40 ) & 0x00FF000000000000 ) | - (( *x << 56 ) & 0xFF00000000000000 ) ; -#endif -} - #endif // _SG_LOWLEVEL_HXX