vendor protobuf & grpc
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
11
vendor/github.com/gogo/protobuf/plugin/size/size.go
generated
vendored
11
vendor/github.com/gogo/protobuf/plugin/size/size.go
generated
vendored
@@ -141,6 +141,7 @@ type size struct {
|
||||
atleastOne bool
|
||||
localName string
|
||||
typesPkg generator.Single
|
||||
bitsPkg generator.Single
|
||||
}
|
||||
|
||||
func NewSize() *size {
|
||||
@@ -188,14 +189,7 @@ func keySize(fieldNumber int32, wireType int) int {
|
||||
func (p *size) sizeVarint() {
|
||||
p.P(`
|
||||
func sov`, p.localName, `(x uint64) (n int) {
|
||||
for {
|
||||
n++
|
||||
x >>= 7
|
||||
if x == 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
return n
|
||||
return (`, p.bitsPkg.Use(), `.Len64(x | 1) + 6)/ 7
|
||||
}`)
|
||||
}
|
||||
|
||||
@@ -589,6 +583,7 @@ func (p *size) Generate(file *generator.FileDescriptor) {
|
||||
p.localName = generator.FileName(file)
|
||||
p.typesPkg = p.NewImport("github.com/gogo/protobuf/types")
|
||||
protoPkg := p.NewImport("github.com/gogo/protobuf/proto")
|
||||
p.bitsPkg = p.NewImport("math/bits")
|
||||
if !gogoproto.ImportsGoGoProto(file.FileDescriptorProto) {
|
||||
protoPkg = p.NewImport("github.com/golang/protobuf/proto")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user