Fully unroll read_varint and fix 64bit bugs.