1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-27 12:14:26 +01:00

Fixed endianess issues in several classes. Everything is working on big endian architectures so far.

This commit is contained in:
Matias Fontanini
2012-08-21 00:03:55 -03:00
parent 3ef29f831b
commit 80198909eb
12 changed files with 281 additions and 134 deletions

View File

@@ -37,6 +37,9 @@
#include "hwaddress.h"
#include "network_interface.h"
#define TINS_IS_LITTLE_ENDIAN (__BYTE_ORDER == __LITTLE_ENDIAN)
#define TINS_IS_BIG_ENDIAN (__BYTE_ORDER == __BIG_ENDIAN)
namespace Tins {
/**
* \brief Network utils namespace.
@@ -183,7 +186,7 @@ namespace Tins {
(change_endian(((uint32_t)(data >> 32)))));
}
#if __BYTE_ORDER == __LITTLE_ENDIAN
#if TINS_IS_LITTLE_ENDIAN
/**
* \brief Convert any integral type to big endian.
*
@@ -225,7 +228,7 @@ namespace Tins {
inline T le_to_host(T data) {
return data;
}
#elif __BYTE_ORDER == __BIG_ENDIAN
#elif TINS_IS_BIG_ENDIAN
/**
* \brief Convert any integral type to big endian.
*