summaryrefslogtreecommitdiff
path: root/src/mem/gems_common
diff options
context:
space:
mode:
Diffstat (limited to 'src/mem/gems_common')
-rw-r--r--src/mem/gems_common/std-includes.hh4
-rw-r--r--src/mem/gems_common/util.cc18
-rw-r--r--src/mem/gems_common/util.hh1
3 files changed, 20 insertions, 3 deletions
diff --git a/src/mem/gems_common/std-includes.hh b/src/mem/gems_common/std-includes.hh
index 619214f1d..d6062337f 100644
--- a/src/mem/gems_common/std-includes.hh
+++ b/src/mem/gems_common/std-includes.hh
@@ -26,6 +26,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/*
+ * $Id: std-includes.hh,v 3.7 2003/02/24 21:05:24 xu Exp $
+ */
+
#ifndef INCLUDES_H
#define INCLUDES_H
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)
{
diff --git a/src/mem/gems_common/util.hh b/src/mem/gems_common/util.hh
index 7b32f24e8..7afe57a85 100644
--- a/src/mem/gems_common/util.hh
+++ b/src/mem/gems_common/util.hh
@@ -39,6 +39,7 @@ string string_split(string& str, char split_character);
string bool_to_string(bool value);
string int_to_string(int n, bool zero_fill = false, int width = 0);
float string_to_float(string& str);
+bool string_to_bool(const string & str);
int log_int(long long n);
bool is_power_of_2(long long n);