From 039d914068f539f6463413351e7769518efb1e9e Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Sun, 7 Jan 2018 19:35:40 -0800 Subject: 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 Reviewed-by: Jason Lowe-Power --- src/sim/serialize.hh | 34 +++++++++++++++++++++------------- 1 file 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 void paramOut(CheckpointOut &cp, const std::string &name, const T ¶m); -template -void paramOut(CheckpointOut &cp, const std::string &name, - const BitfieldBackend::BitUnionOperators &p) +template +void +paramOut(CheckpointOut &cp, const std::string &name, const BitUnionType &p) { - paramOut(cp, name, p.__storage); + paramOut(cp, name, static_cast >(p)); } template void paramIn(CheckpointIn &cp, const std::string &name, T ¶m); -template -void paramIn(CheckpointIn &cp, const std::string &name, - BitfieldBackend::BitUnionOperators &p) +template +void +paramIn(CheckpointIn &cp, const std::string &name, BitUnionType &p) { - paramIn(cp, name, p.__storage); + BitUnionBaseType b; + paramIn(cp, name, b); + p = b; } template bool optParamIn(CheckpointIn &cp, const std::string &name, T ¶m, bool warn = true); -template -bool optParamIn(CheckpointIn &cp, const std::string &name, - BitfieldBackend::BitUnionOperators &p, - bool warn = true) +template +bool +optParamIn(CheckpointIn &cp, const std::string &name, + BitUnionType &p, bool warn = true) { - return optParamIn(cp, name, p.__storage, warn); + BitUnionBaseType b; + if (optParamIn(cp, name, b, warn)) { + p = b; + return true; + } else { + return false; + } } template -- cgit v1.2.3