summaryrefslogtreecommitdiff
path: root/src/mem/gems_common
diff options
context:
space:
mode:
authorNathan Binkert <nate@binkert.org>2009-07-06 15:49:47 -0700
committerNathan Binkert <nate@binkert.org>2009-07-06 15:49:47 -0700
commit92de70b69aaf3f399a855057b556ed198139e5d8 (patch)
treef8e7d0d494df8810cc960be4c52d8b555471f157 /src/mem/gems_common
parent05f6a4a6b92370162da17ef5cccb5a7e3ba508e5 (diff)
downloadgem5-92de70b69aaf3f399a855057b556ed198139e5d8.tar.xz
ruby: Import the latest ruby changes from gems.
This was done with an automated process, so there could be things that were done in this tree in the past that didn't make it. One known regression is that atomic memory operations do not seem to work properly anymore.
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);