aboutsummaryrefslogtreecommitdiff
path: root/paludis/util/byte_swap.hh
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2011-10-09 19:50:29 +0100
committerAvatar David Leverton <levertond@googlemail.com> 2011-10-14 23:04:29 +0100
commitd73045dd1c1dd9c11e8a1ae6890137df9f9b3c7c (patch)
tree10f2589eaa7fbc91929bae9eb59350bb70849b50 /paludis/util/byte_swap.hh
parent69295f04a92ba99d4c2b210c77e80ab48e4be621 (diff)
downloadpaludis-d73045dd1c1dd9c11e8a1ae6890137df9f9b3c7c.tar.gz
paludis-d73045dd1c1dd9c11e8a1ae6890137df9f9b3c7c.tar.xz
Move to/from_bigendian to byte_swap.hh
Diffstat (limited to 'paludis/util/byte_swap.hh')
-rw-r--r--paludis/util/byte_swap.hh30
1 files changed, 30 insertions, 0 deletions
diff --git a/paludis/util/byte_swap.hh b/paludis/util/byte_swap.hh
index b19fce38e..2ba778644 100644
--- a/paludis/util/byte_swap.hh
+++ b/paludis/util/byte_swap.hh
@@ -75,6 +75,36 @@ namespace paludis
{
return byte_swap_internals::ByteSwap<sizeof(T_), T_>::swap(x);
}
+
+#ifdef PALUDIS_BIG_ENDIAN
+ template <typename T_>
+ inline T_
+ from_bigendian(T_ x)
+ {
+ return x;
+ }
+
+ template <typename T_>
+ inline T_
+ to_bigendian(T_ x)
+ {
+ return x;
+ }
+#else
+ template <typename T_>
+ inline T_
+ from_bigendian(T_ x)
+ {
+ return byte_swap(x);
+ }
+
+ template <typename T_>
+ inline T_
+ to_bigendian(T_ x)
+ {
+ return byte_swap(x);
+ }
+#endif
}
#endif