summaryrefslogtreecommitdiff
path: root/src/mem/ruby/config/util.rb
diff options
context:
space:
mode:
authorDerek Hower <drh5@cs.wisc.edu>2009-08-05 14:20:32 -0500
committerDerek Hower <drh5@cs.wisc.edu>2009-08-05 14:20:32 -0500
commitfbf7391bb0aa3c32289abb8a1b1066267df7c705 (patch)
treee05f36245b08938be2c87c29ef97c8f349e02956 /src/mem/ruby/config/util.rb
parent1276df51e245c6e836d7e96c0df66a7b74b549c9 (diff)
downloadgem5-fbf7391bb0aa3c32289abb8a1b1066267df7c705.tar.xz
ruby: configuration supports multiple runs in same session
These changes allow to run Ruby-gems multiple times from the same ruby-lang script with different configurations
Diffstat (limited to 'src/mem/ruby/config/util.rb')
-rw-r--r--src/mem/ruby/config/util.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/mem/ruby/config/util.rb b/src/mem/ruby/config/util.rb
new file mode 100644
index 000000000..a6aa8f6ab
--- /dev/null
+++ b/src/mem/ruby/config/util.rb
@@ -0,0 +1,10 @@
+
+def log_int(n)
+ assert(n.is_a?(Fixnum), "log_int takes a number for an argument")
+ counter = 0
+ while n >= 2 do
+ counter += 1
+ n = n >> 1
+ end
+ return counter
+end