diff options
author | Gabe Black <gabeblack@google.com> | 2018-01-07 19:35:40 -0800 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2018-01-20 07:30:10 +0000 |
commit | 039d914068f539f6463413351e7769518efb1e9e (patch) | |
tree | 3918ae9181fe26aa1b24446fa252a42d1c852290 | |
parent | 0d56fdef7a60691c59e1782a5c5c0a532dcdeeea (diff) | |
download | gem5-039d914068f539f6463413351e7769518efb1e9e.tar.xz |
sim: Use the new BitUnion templates in serialize.hh.
serialize.hh should not reference internal implementation details in
the underlying BitUnion types.
Change-Id: I1ce29243db63801b7788f037fdc54811bdab889c
Reviewed-on: https://gem5-review.googlesource.com/7203
Maintainer: Gabe Black <gabeblack@google.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
-rw-r--r-- | src/sim/serialize.hh | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/src/sim/serialize.hh b/src/sim/serialize.hh index b6c026394..024d29cbb 100644 --- a/src/sim/serialize.hh +++ b/src/sim/serialize.hh @@ -72,33 +72,41 @@ typedef std::ostream CheckpointOut; template <class T> void paramOut(CheckpointOut &cp, const std::string &name, const T ¶m); -template <typename BitUnion> -void paramOut(CheckpointOut &cp, const std::string &name, - const BitfieldBackend::BitUnionOperators<BitUnion> &p) +template <typename T> +void +paramOut(CheckpointOut &cp, const std::string &name, const BitUnionType<T> &p) { - paramOut(cp, name, p.__storage); + paramOut(cp, name, static_cast<BitUnionBaseType<T> >(p)); } template <class T> void paramIn(CheckpointIn &cp, const std::string &name, T ¶m); -template <typename BitUnion> -void paramIn(CheckpointIn &cp, const std::string &name, - BitfieldBackend::BitUnionOperators<BitUnion> &p) +template <typename T> +void +paramIn(CheckpointIn &cp, const std::string &name, BitUnionType<T> &p) { - paramIn(cp, name, p.__storage); + BitUnionBaseType<T> b; + paramIn(cp, name, b); + p = b; } template <class T> bool optParamIn(CheckpointIn &cp, const std::string &name, T ¶m, bool warn = true); -template <typename BitUnion> -bool optParamIn(CheckpointIn &cp, const std::string &name, - BitfieldBackend::BitUnionOperators<BitUnion> &p, - bool warn = true) +template <typename T> +bool +optParamIn(CheckpointIn &cp, const std::string &name, + BitUnionType<T> &p, bool warn = true) { - return optParamIn(cp, name, p.__storage, warn); + BitUnionBaseType<T> b; + if (optParamIn(cp, name, b, warn)) { + p = b; + return true; + } else { + return false; + } } template <class T> |