diff options
Diffstat (limited to 'src/mem/gems_common/util.cc')
-rw-r--r-- | src/mem/gems_common/util.cc | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/mem/gems_common/util.cc b/src/mem/gems_common/util.cc index a64da15a6..403be383f 100644 --- a/src/mem/gems_common/util.cc +++ b/src/mem/gems_common/util.cc @@ -30,8 +30,7 @@ * $Id$ */ -#include <cassert> - +#include "assert.hh" #include "mem/gems_common/util.hh" // Split a string into a head and tail strings on the specified @@ -43,7 +42,7 @@ string string_split(string& str, char split_character) string head = ""; string tail = ""; - unsigned counter = 0; + uint counter = 0; while(counter < str.size()) { if (str[counter] == split_character) { counter++; @@ -91,6 +90,19 @@ float string_to_float(string& str) return ret; } +bool string_to_bool(const string & str) +{ + string lower(str); + for (size_t i=0;i<str.length();i++) + lower[i] = tolower(str[i]); + if (lower == "true") + return true; + else if (lower == "false") + return false; + else + assert(0); +} + // Log functions int log_int(long long n) { |