# File lib/ruby-vpi/integer.rb, line 11
  def log2
    raise "integer must be positive" if self < 0
    bin = to_s(2)

    if bin =~ /^10+$/
      bin.length - 1
    else
      bin.length
    end
  end