package cidimport ()// Version of varint function that works with a string rather than// []byte to avoid unnecessary allocation// Copyright 2011 The Go Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license as given at https://golang.org/LICENSE// uvarint decodes a uint64 from buf and returns that value and the// number of bytes read (> 0). If an error occurred, then 0 is// returned for both the value and the number of bytes read, and an// error is returned.func uvarint( string) (uint64, int, error) {varuint64varuint// we have a binary string so we can't use a range loopfor := 0; < len(); ++ { := []if < 0x80 {if > 9 || == 9 && > 1 {return0, 0, varint.ErrOverflow }if == 0 && > 0 {return0, 0, varint.ErrNotMinimal }return | uint64()<<, + 1, nil } |= uint64(&0x7f) << += 7 }return0, 0, varint.ErrUnderflow}
The pages are generated with Goldsv0.8.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.