From 675b4aa878f16291ce33fced48a2bc7425f635ae Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Sun, 24 Nov 2013 14:19:41 +0000 Subject: Moved source to src --- source/Endianness.h | 70 ----------------------------------------------------- 1 file changed, 70 deletions(-) delete mode 100644 source/Endianness.h (limited to 'source/Endianness.h') diff --git a/source/Endianness.h b/source/Endianness.h deleted file mode 100644 index 86eb369f5..000000000 --- a/source/Endianness.h +++ /dev/null @@ -1,70 +0,0 @@ - -#pragma once - - - - - -// Changes endianness -inline unsigned long long HostToNetwork8(const void* a_Value ) -{ - unsigned long long __HostToNetwork8; - memcpy( &__HostToNetwork8, a_Value, sizeof( __HostToNetwork8 ) ); - __HostToNetwork8 = (( ( (unsigned long long)htonl((u_long)__HostToNetwork8) ) << 32) + htonl(__HostToNetwork8 >> 32)); - return __HostToNetwork8; -} - - - - - -inline unsigned int HostToNetwork4(const void* a_Value ) -{ - unsigned int __HostToNetwork4; - memcpy( &__HostToNetwork4, a_Value, sizeof( __HostToNetwork4 ) ); - __HostToNetwork4 = ntohl( __HostToNetwork4 ); - return __HostToNetwork4; -} - - - - - -inline double NetworkToHostDouble8(const void* a_Value ) -{ -#define ntohll(x) ((((unsigned long long)ntohl((u_long)x)) << 32) + ntohl(x >> 32)) - unsigned long long buf = 0;//(*(unsigned long long*)a_Value); - memcpy( &buf, a_Value, 8 ); - buf = ntohll(buf); - double x; - memcpy(&x, &buf, sizeof(double)); - return x; -} - - - - - -inline long long NetworkToHostLong8(const void * a_Value ) -{ - unsigned long long buf = *(unsigned long long*)a_Value; - buf = ntohll(buf); - return *reinterpret_cast(&buf); -} - - - - - -inline float NetworkToHostFloat4(const void* a_Value ) -{ - u_long buf = *(u_long*)a_Value; - buf = ntohl( buf ); - float x = 0; - memcpy( &x, &buf, sizeof(float) ); - return x; -} - - - - -- cgit v1.2.3