Varint encoding in Scala