# File lib/ruby-vpi/integer.rb, line 24 24: def log2 25: raise "integer must be positive" if self < 0 26: bin = to_s(2) 27: 28: if bin =~ /^10+$/ 29: bin.length - 1 30: else 31: bin.length 32: end 33: end