Optimize writeVarInt.
Optimize writeVarInt.

Before:

BenchmarkWriteVarInt1   10000000               173 ns/op
BenchmarkWriteVarInt3    2000000               965 ns/op
BenchmarkWriteVarInt5    2000000               966 ns/op
BenchmarkWriteVarInt9    2000000               968 ns/op

After:

BenchmarkWriteVarInt1   20000000               101 ns/op
BenchmarkWriteVarInt3   20000000               136 ns/op
BenchmarkWriteVarInt5   10000000               142 ns/op
BenchmarkWriteVarInt9   10000000               156 ns/op

This is part of the ongoing effort to optimize serialization as noted in
conformal/btcd#27.

glv2/ppcd,ppcsuite/ppcd,CryptocurrencyCabal/htcd,qchain/btcd,jrick/btcd,DanielKrawisz/btcd,stevenroose/btcd,tb00/btcd,jrick/dcrd,ltcsuite/ltcd,davecgh/btcd,adiabat/btcd,hectorj/btcd,danoctavian/btcd,cqswxj2013/btcd,danoctavian/btcd,soapboxsys/ombfullnode,toddfries/btcd,runeaune/btcd,mathiasrw/btcd,ppcsuite/ppcd-old,aakselrod/btcd,Stash-Crypto/btcd,BitGo/prova,FactomProject/btcd,dan-da/btcd,mathiasrw/btcd,cjepson/btcd,jcmincke/dcrd,Roasbeef/btcd,1d4Nf6/btcd,jcmincke/dcrd,Dirbaio/btcd,jongillham/btcd,jimmysong/btcd,Cleawing/btcd,Roasbeef/btcd,FactomProject/btcd,cjepson/btcd,Dirbaio/btcd,tb00/btcd,jimmysong/btcd,DanielKrawisz/btcd,wallclockbuilder/btcd,jrick/dcrd,decred/dcrd,runeaune/btcd,toddfries/btcd,qchain/btcd,jrick/btcd,davecgh/btcd,pkothbauer/btcd,dan-da/btcd,dajohi/btcd,Dirbaio/btcd,dajohi/btcd,pkothbauer/btcd,ppcsuite/ppcd-old,Cleawing/btcd,hectorj/btcd,btcsuitereleases/btcd,jongillham/btcd,ltcsuite/ltcd,CryptocurrencyCabal/htcd,btcsuite/btcd,BitGo/prova,adiabat/btcd,decred/dcrd,aakselrod/btcd,jcmincke/dcrd,ppcsuite/ppcd,dajohi/btcd,wallclockbuilder/btcd,glv2/ppcd,cqswxj2013/btcd,btcsuitereleases/btcd,1d4Nf6/btcd,soapboxsys/ombfullnode,Stash-Crypto/btcd,jrick/btcd,stevenroose/btcd,btcsuite/btcd