summaryrefslogtreecommitdiff
path: root/src/basic/unaligned.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-06-07 11:13:39 +0200
committerLennart Poettering <lennart@poettering.net>2016-06-07 11:13:39 +0200
commita849538e3bf0097595fc1fd86bcda608d1151b4c (patch)
tree20e5dbc1399719e7e24ac6997adf2428a8cdce51 /src/basic/unaligned.h
parent82e4eda664d40ef60829e27d84b1610c2f4070cd (diff)
parent1e7a0e21c97ac1bbc743009e5ec8c12bc6200e19 (diff)
Merge pull request #3394 from poettering/triple-tstamp
timestamping improvements and IPv6 RA revamp
Diffstat (limited to 'src/basic/unaligned.h')
-rw-r--r--src/basic/unaligned.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/basic/unaligned.h b/src/basic/unaligned.h
index 79be645bed..7c847a3ccb 100644
--- a/src/basic/unaligned.h
+++ b/src/basic/unaligned.h
@@ -109,3 +109,21 @@ static inline void unaligned_write_le64(void *_u, uint64_t a) {
unaligned_write_le32(u, (uint32_t) a);
unaligned_write_le32(u + 4, (uint32_t) (a >> 32));
}
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define unaligned_read_ne16 unaligned_read_be16
+#define unaligned_read_ne32 unaligned_read_be32
+#define unaligned_read_ne64 unaligned_read_be64
+
+#define unaligned_write_ne16 unaligned_write_be16
+#define unaligned_write_ne32 unaligned_write_be32
+#define unaligned_write_ne64 unaligned_write_be64
+#else
+#define unaligned_read_ne16 unaligned_read_le16
+#define unaligned_read_ne32 unaligned_read_le32
+#define unaligned_read_ne64 unaligned_read_le64
+
+#define unaligned_write_ne16 unaligned_write_le16
+#define unaligned_write_ne32 unaligned_write_le32
+#define unaligned_write_ne64 unaligned_write_le64
+#endif