From 94b603c9f25c1ecd89ae6b4366b8129b50ae612e Mon Sep 17 00:00:00 2001 From: Ilari Liusvaara Date: Wed, 4 Feb 2015 21:28:25 +0200 Subject: [PATCH] Fix some compilation errors on Mac OS X --- include/library/serialization.hpp | 24 ++++++++++-------------- src/library/hex.cpp | 4 ++++ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/library/serialization.hpp b/include/library/serialization.hpp index 0c3b5ff3..bcdba471 100644 --- a/include/library/serialization.hpp +++ b/include/library/serialization.hpp @@ -7,35 +7,31 @@ namespace serialization { -template struct unsigned_of {}; -template<> struct unsigned_of { typedef uint8_t t; }; -template<> struct unsigned_of { typedef uint8_t t; }; -template<> struct unsigned_of { typedef uint16_t t; }; -template<> struct unsigned_of { typedef uint16_t t; }; -template<> struct unsigned_of { typedef uint32_t t; }; -template<> struct unsigned_of { typedef uint32_t t; }; -template<> struct unsigned_of { typedef uint64_t t; }; -template<> struct unsigned_of { typedef uint64_t t; }; +template struct unsigned_of {}; +template<> struct unsigned_of<1> { typedef uint8_t t; }; +template<> struct unsigned_of<2> { typedef uint16_t t; }; +template<> struct unsigned_of<4> { typedef uint32_t t; }; +template<> struct unsigned_of<8> { typedef uint64_t t; }; template void write_common(uint8_t* target, T1 value) { for(size_t i = 0; i < sizeof(T1); i++) if(be) - target[i] = static_cast::t>(value) >> 8 * (sizeof(T1) - i - 1); + target[i] = static_cast::t>(value) >> 8 * (sizeof(T1) - i - 1); else - target[i] = static_cast::t>(value) >> 8 * i; + target[i] = static_cast::t>(value) >> 8 * i; } template T1 read_common(const uint8_t* source) { - typename unsigned_of::t value = 0; + typename unsigned_of::t value = 0; for(size_t i = 0; i < sizeof(T1); i++) if(be) - value |= static_cast::t>(source[i]) << 8 * (sizeof(T1) - i - 1); + value |= static_cast::t>(source[i]) << 8 * (sizeof(T1) - i - 1); else - value |= static_cast::t>(source[i]) << 8 * i; + value |= static_cast::t>(source[i]) << 8 * i; return static_cast(value); } diff --git a/src/library/hex.cpp b/src/library/hex.cpp index 23c4cd71..18f53cbd 100644 --- a/src/library/hex.cpp +++ b/src/library/hex.cpp @@ -91,6 +91,10 @@ void _ref() _ref2(); _ref2(); _ref2(); + _ref2(); + _ref2(); + _ref2(); + _ref2(); } }