From 81b3c9cfbdd99740320bfaf54eaf3929772f5eee Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 25 Oct 2018 11:43:15 +0200 Subject: Remove unused code --- project.conf | 4 +- sibs/SafeSerializer.hpp | 1 + sibs/endian.hpp | 99 ------------------------------------------------- 3 files changed, 3 insertions(+), 101 deletions(-) diff --git a/project.conf b/project.conf index f7ac4e9..684b086 100644 --- a/project.conf +++ b/project.conf @@ -1,8 +1,8 @@ [package] name = "sibs-serializer" -version = "2.0.0" +version = "2.0.1" type = "static" platforms = ["any"] [config] -expose_include_dirs = ["."] \ No newline at end of file +expose_include_dirs = ["."] diff --git a/sibs/SafeSerializer.hpp b/sibs/SafeSerializer.hpp index 68b6e7c..95e7807 100644 --- a/sibs/SafeSerializer.hpp +++ b/sibs/SafeSerializer.hpp @@ -25,6 +25,7 @@ namespace sibs void add(const T &data) { usize offset = buffer.size(); + (void)offset; buffer.insert(buffer.end(), (unsigned char*)&data, (unsigned char*)&data + sizeof(T)); #if BYTE_ORDER == BIG_ENDIAN std::reverse((char*)&buffer[offset], (char*)&buffer[offset] + sizeof(T)); diff --git a/sibs/endian.hpp b/sibs/endian.hpp index 13e6a31..14adeaa 100644 --- a/sibs/endian.hpp +++ b/sibs/endian.hpp @@ -58,102 +58,3 @@ defined(__alpha__) || defined(__alpha) #endif #endif #endif - -#include "types.hpp" -#include - -namespace sibs -{ - #if defined(_MSC_VER) - static u16 byteswap(u16 value) - { - return _byteswap_ushort(value); - } - static u32 byteswap(u32 value) - { - return _byteswap_ulong(value); - } - static u64 byteswap(u64 value) - { - return _byteswap_uint64(value); - } - #elif defined(__GCC__) - static u16 byteswap(u16 value) - { - return __builtin_bswap16(value); - } - static u32 byteswap(u32 value) - { - return __builtin_bswap32(value); - } - static u64 byteswap(u64 value) - { - return __builtin_bswap64(value); - } - #else - static u16 byteswap(u16 value) - { - u16 result = 0; - result |= (value & 0x00FF) << 8; - result |= (value & 0xFF00) >> 8; - return result; - } - static u32 byteswap(u32 value) - { - u32 result = 0; - result |= (value & 0x000000FF) << 24; - result |= (value & 0x0000FF00) << 8; - result |= (value & 0x00FF0000) >> 8; - result |= (value & 0xFF000000) >> 24; - return result; - } - static u64 byteswap(u64 value) - { - u64 result = 0; - result |= (value & 0x00000000000000FF) << 56; - result |= (value & 0x000000000000FF00) << 40; - result |= (value & 0x0000000000FF0000) << 24; - result |= (value & 0x00000000FF000000) << 8; - result |= (value & 0x000000FF00000000) >> 8; - result |= (value & 0x0000FF0000000000) >> 24; - result |= (value & 0x00FF000000000000) >> 40; - result |= (value & 0xFF00000000000000) >> 56; - return result; - } - #endif - - static u16 byteswap16(u16 value) - { - return byteswap(value); - } - - static u32 byteswap32(u32 value) - { - return byteswap(value); - } - - static u64 byteswap64(u64 value) - { - return byteswap(value); - } - - enum class Endianness - { - LITTLE, - BIG, - MIDDLE, // TODO: Implement conversion from/to middle endian - UNKNOWN - }; - - static Endianness getEndianness() - { - u32 endian = 0x12345678; - u8 *endianByte = (u8*)&endian; - if (endianByte[0] == (u8)0x78 && endianByte[1] == (u8)0x56) - return Endianness::LITTLE; - else if (endianByte[0] == (u8)0x12 && endianByte[1] == (u8)0x34) - return Endianness::BIG; - else - return Endianness::UNKNOWN; - } -} -- cgit v1.2.3