vendor: update dependencies with github.com/kardianos/govendor

This commit is contained in:
Felix Lange
2017-02-16 13:21:11 +01:00
parent c8695fae35
commit 2c4455b12a
168 changed files with 3394 additions and 6327 deletions

View File

@ -14,22 +14,19 @@ const (
vlqContinuationBit = vlqBase
)
var (
decodeMap [256]int
)
var decodeMap [256]byte
func init() {
for i := 0; i < len(encodeStd); i++ {
decodeMap[encodeStd[i]] = i
decodeMap[encodeStd[i]] = byte(i)
}
}
func toVLQSigned(n int) int {
if n < 0 {
return -n<<1 + 1
} else {
return n << 1
}
return n << 1
}
func fromVLQSigned(n int) int {
@ -51,7 +48,7 @@ func NewEncoder(w io.ByteWriter) *Encoder {
}
}
func (enc *Encoder) Encode(n int) error {
func (enc Encoder) Encode(n int) error {
n = toVLQSigned(n)
for digit := vlqContinuationBit; digit&vlqContinuationBit != 0; {
digit = n & vlqBaseMask
@ -59,6 +56,7 @@ func (enc *Encoder) Encode(n int) error {
if n > 0 {
digit |= vlqContinuationBit
}
err := enc.w.WriteByte(encodeStd[digit])
if err != nil {
return err
@ -77,7 +75,7 @@ func NewDecoder(r io.ByteReader) *Decoder {
}
}
func (dec *Decoder) Decode() (n int, err error) {
func (dec Decoder) Decode() (n int, err error) {
shift := uint(0)
for continuation := true; continuation; {
c, err := dec.r.ReadByte()
@ -85,10 +83,9 @@ func (dec *Decoder) Decode() (n int, err error) {
return 0, err
}
digit := decodeMap[c]
continuation = digit&vlqContinuationBit != 0
digit &= vlqBaseMask
n = n + digit<<shift
c = decodeMap[c]
continuation = c&vlqContinuationBit != 0
n += int(c&vlqBaseMask) << shift
shift += vlqBaseShift
}
return fromVLQSigned(n), nil