diff options
Diffstat (limited to 'src/sim')
-rw-r--r-- | src/sim/byteswap.hh | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/sim/byteswap.hh b/src/sim/byteswap.hh index 23786bb71..02a053308 100644 --- a/src/sim/byteswap.hh +++ b/src/sim/byteswap.hh @@ -139,6 +139,15 @@ inline Twin32_t swap_byte<Twin32_t>(Twin32_t x) 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);} |