[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r19554 - in gnunet/src: include util
From: |
gnunet |
Subject: |
[GNUnet-SVN] r19554 - in gnunet/src: include util |
Date: |
Mon, 30 Jan 2012 23:10:34 +0100 |
Author: grothoff
Date: 2012-01-30 23:10:33 +0100 (Mon, 30 Jan 2012)
New Revision: 19554
Modified:
gnunet/src/include/gnunet_common.h
gnunet/src/include/gnunet_tun_lib.h
gnunet/src/util/common_endian.c
Log:
-fix endian test
Modified: gnunet/src/include/gnunet_common.h
===================================================================
--- gnunet/src/include/gnunet_common.h 2012-01-30 22:01:44 UTC (rev 19553)
+++ gnunet/src/include/gnunet_common.h 2012-01-30 22:10:33 UTC (rev 19554)
@@ -66,6 +66,15 @@
#define GNUNET_MAX(a,b) (((a) > (b)) ? (a) : (b))
+/* some systems use one underscore only... */
+#ifndef __BYTE_ORDER
+#ifdef _BYTE_ORDER
+#define __BYTE_ORDER _BYTE_ORDER
+#define __LITTLE_ENDIAN _LITTLE_ENDIAN
+#define __BIG_ENDIAN _BIG_ENDIAN
+#endif
+#endif
+
/**
* Endian operations
*/
Modified: gnunet/src/include/gnunet_tun_lib.h
===================================================================
--- gnunet/src/include/gnunet_tun_lib.h 2012-01-30 22:01:44 UTC (rev 19553)
+++ gnunet/src/include/gnunet_tun_lib.h 2012-01-30 22:10:33 UTC (rev 19554)
@@ -70,10 +70,10 @@
*/
struct GNUNET_TUN_IPv4Header
{
-#if __BYTE_ORDER == __LITTLE_ENDIAN || _BYTE_ORDER == _LITTLE_ENDIAN
+#if __BYTE_ORDER == __LITTLE_ENDIAN
unsigned int header_length:4 GNUNET_PACKED;
unsigned int version:4 GNUNET_PACKED;
-#elif __BYTE_ORDER == __BIG_ENDIAN || _BYTE_ORDER == _BIG_ENDIAN
+#elif __BYTE_ORDER == __BIG_ENDIAN
unsigned int version:4 GNUNET_PACKED;
unsigned int header_length:4 GNUNET_PACKED;
#else
@@ -127,12 +127,12 @@
*/
struct GNUNET_TUN_IPv6Header
{
-#if __BYTE_ORDER == __LITTLE_ENDIAN || _BYTE_ORDER == _LITTLE_ENDIAN
+#if __BYTE_ORDER == __LITTLE_ENDIAN
unsigned int traffic_class_h:4 GNUNET_PACKED;
unsigned int version:4 GNUNET_PACKED;
unsigned int traffic_class_l:4 GNUNET_PACKED;
unsigned int flow_label:20 GNUNET_PACKED;
-#elif __BYTE_ORDER == __BIG_ENDIAN || _BYTE_ORDER == _BIG_ENDIAN
+#elif __BYTE_ORDER == __BIG_ENDIAN
unsigned int version:4 GNUNET_PACKED;
unsigned int traffic_class:8 GNUNET_PACKED;
unsigned int flow_label:20 GNUNET_PACKED;
@@ -183,7 +183,7 @@
* Acknowledgement number.
*/
uint32_t ack GNUNET_PACKED;
-#if __BYTE_ORDER == __LITTLE_ENDIAN || _BYTE_ORDER == _LITTLE_ENDIAN
+#if __BYTE_ORDER == __LITTLE_ENDIAN
/**
* Reserved. Must be zero.
*/
@@ -192,7 +192,7 @@
* Number of 32-bit words in TCP header.
*/
unsigned int off : 4 GNUNET_PACKED;
-#elif __BYTE_ORDER == __BIG_ENDIAN || _BYTE_ORDER == _BIG_ENDIAN
+#elif __BYTE_ORDER == __BIG_ENDIAN
/**
* Number of 32-bit words in TCP header.
*/
Modified: gnunet/src/util/common_endian.c
===================================================================
--- gnunet/src/util/common_endian.c 2012-01-30 22:01:44 UTC (rev 19553)
+++ gnunet/src/util/common_endian.c 2012-01-30 22:10:33 UTC (rev 19554)
@@ -32,9 +32,9 @@
uint64_t
GNUNET_ntohll (uint64_t n)
{
-#if __BYTE_ORDER == __BIG_ENDIAN || _BYTE_ORDER == _BIG_ENDIAN
+#if __BYTE_ORDER == __BIG_ENDIAN
return n;
-#elif __BYTE_ORDER == __LITTLE_ENDIAN || _BYTE_ORDER == _LITTLE_ENDIAN
+#elif __BYTE_ORDER == __LITTLE_ENDIAN
return (((uint64_t) ntohl (n)) << 32) + ntohl (n >> 32);
#else
#error byteorder undefined
@@ -44,9 +44,9 @@
uint64_t
GNUNET_htonll (uint64_t n)
{
-#if __BYTE_ORDER == __BIG_ENDIAN || _BYTE_ORDER == _BIG_ENDIAN
+#if __BYTE_ORDER == __BIG_ENDIAN
return n;
-#elif __BYTE_ORDER == __LITTLE_ENDIAN || _BYTE_ORDER == _LITTLE_ENDIAN
+#elif __BYTE_ORDER == __LITTLE_ENDIAN
return (((uint64_t) htonl (n)) << 32) + htonl (n >> 32);
#else
#error byteorder undefined
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r19554 - in gnunet/src: include util,
gnunet <=