aboutsummaryrefslogtreecommitdiff
path: root/paludis/util/byte_swap.hh
diff options
context:
space:
mode:
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