From 8315157349bc1a98613bcc9c6e3a6bec532b4691 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 16 May 2018 00:21:24 +0200 Subject: Optimize for little endian instead of big endian --- sibs/SafeDeserializer.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sibs/SafeDeserializer.hpp') diff --git a/sibs/SafeDeserializer.hpp b/sibs/SafeDeserializer.hpp index 7ef6b3f..0110920 100644 --- a/sibs/SafeDeserializer.hpp +++ b/sibs/SafeDeserializer.hpp @@ -38,7 +38,7 @@ namespace sibs verifyExtractSize(typeSize); size -= typeSize; T result; - #ifdef LITTLE_ENDIAN + #if BYTE_ORDER == BIG_ENDIAN switch(typeSize) { case 1: @@ -63,7 +63,7 @@ namespace sibs } } #else - memcpy(&result, data, typeSize); + result = *(T*)data; #endif data += typeSize; return result; -- cgit v1.2.3