diff options
Diffstat (limited to 'src/sim')
-rw-r--r-- | src/sim/serialize.cc | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/src/sim/serialize.cc b/src/sim/serialize.cc index 18af044d0..27bf87254 100644 --- a/src/sim/serialize.cc +++ b/src/sim/serialize.cc @@ -111,38 +111,25 @@ showParam(ostream &os, const unsigned char &value) } -// Use sscanf() for FP types as to_number() only handles integers template <> bool parseParam(const string &s, float &value) { - return (sscanf(s.c_str(), "%f", &value) == 1); + return to_number(s, value); } template <> bool parseParam(const string &s, double &value) { - return (sscanf(s.c_str(), "%lf", &value) == 1); + return to_number(s, value); } template <> bool parseParam(const string &s, bool &value) { - const string &ls = to_lower(s); - - if (ls == "true") { - value = true; - return true; - } - - if (ls == "false") { - value = false; - return true; - } - - return false; + return to_bool(s, value); } // Display bools as strings |