summaryrefslogtreecommitdiff
path: root/src/mem/ruby/config/util.rb
blob: a6aa8f6ab4b8abc671a85d44b63c69ff5b74deee (plain)
1
2
3
4
5
6
7
8
9
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