Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/6581
Change subject: base: Add endianness conversion functions for std::array
types.
......................................................................
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
---
M src/sim/byteswap.hh
1 file changed, 9 insertions(+), 0 deletions(-)
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);}
--
To view, visit https://gem5-review.googlesource.com/6581
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic389eb24bdcdc0081068b0c5a37abdf416f6c924
Gerrit-Change-Number: 6581
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev