possible fix for varintsize(2147483647)
do not use abs(), nwc10++
Fix various errors in varint serialisation code.

write_varint9() was writing a 9th byte when only 8 should have been written.
read_varint9() was reading a 9th byte when only 8 should have been read.

It was also failing to perform its bit shifting operations using 64 bit types,
and had an off-by one error in the shifting if a 9th byte was read.