summaryrefslogtreecommitdiff
path: root/src/mem/ruby/config/util.rb
diff options
context:
space:
mode:
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