base: Add endianness conversion functions for std::array types.

These swap the endianness of each element within the array
individually.

They probably obsolute the Twin(32|64)_t types which I believe were
used for SPARC.

Change-Id: Ic389eb24bdcdc0081068b0c5a37abdf416f6c924
Reviewed-on: https://gem5-review.googlesource.com/6581
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
diff --git a/src/sim/byteswap.hh b/src/sim/byteswap.hh
index 23786bb..02a05330 100644
--- a/src/sim/byteswap.hh
+++ b/src/sim/byteswap.hh
@@ -139,6 +139,15 @@
     return x;
 }
 
+template <typename T, size_t N>
+inline std::array<T, N>
+swap_byte(std::array<T, N> a)
+{
+    for (T &v: a)
+        v = swap_byte(v);
+    return a;
+}
+
 //The conversion functions with fixed endianness on both ends don't need to
 //be in a namespace
 template <typename T> inline T betole(T value) {return swap_byte(value);}