From: Gabe Black Date: Mon, 8 Jan 2018 03:35:40 +0000 (-0800) Subject: sim: Use the new BitUnion templates in serialize.hh. X-Git-Tag: v19.0.0.0~2367 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=039d914068f539f6463413351e7769518efb1e9e;p=gem5.git 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 --- 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