class Bignum

def bit_length

def bit_length
  # We use the fact that bignums use the minimum number of "words" necessary
  # where "words" is some number of bytes <= to the size of a fixnum
  # So we have (size - word_size) * 8 < bit_length <= size * 8
  n = 8 * (size - 42.size)
  smaller = self >> n
  if smaller >= 0
    smaller += 1
  else
    smaller = -smaller
  end
  n + (1..8 * 42.size).bsearch{|i| smaller <= (1 << i) }
end

def dup

def dup
  self
end