Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(85)

Issue 114190043: code review 114190043: goprotobuf: Split encoding of int32 and uint32 fields. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 3 months ago by dsymonds
Modified:
11 years, 3 months ago
Reviewers:
nigeltao
CC:
nigeltao, golang-codereviews
Visibility:
Public.

Description

goprotobuf: Split encoding of int32 and uint32 fields. int32 needs special handling; negative values need to be sign-extended, so need to be converted from uint32 back to int32 before converting to uint64 for the varint encoding step (yielding 10 bytes). uint32 is simpler and stays as just encoding the bit pattern, and thus never takes more than 5 bytes. This permits upgrading int32 fields to int64, and matches C++.

Patch Set 1 #

Patch Set 2 : diff -r a244a9c2c29e https://code.google.com/p/goprotobuf #

Patch Set 3 : diff -r a244a9c2c29e https://code.google.com/p/goprotobuf #

Patch Set 4 : diff -r a244a9c2c29e https://code.google.com/p/goprotobuf #

Unified diffs Side-by-side diffs Delta from patch set Stats (+91 lines, -7 lines) Patch
M proto/all_test.go View 2 chunks +31 lines, -1 line 0 comments Download
M proto/encode.go View 1 chunk +25 lines, -1 line 0 comments Download
M proto/properties.go View 1 chunk +7 lines, -3 lines 0 comments Download
M proto/size_test.go View 1 chunk +2 lines, -0 lines 0 comments Download
M proto/testdata/test.proto View 2 chunks +5 lines, -0 lines 0 comments Download
M proto/testdata/test.pb.go View 4 chunks +19 lines, -2 lines 0 comments Download
M protoc-gen-go/generator/generator.go View 2 chunks +2 lines, -0 lines 0 comments Download

Messages

Total messages: 3
dsymonds
Hello nigeltao (cc: golang-codereviews@googlegroups.com), I'd like you to review this change to https://code.google.com/p/goprotobuf
11 years, 3 months ago (2014-07-22 03:54:10 UTC) #1
nigeltao
LGTM.
11 years, 3 months ago (2014-07-22 04:04:41 UTC) #2
dsymonds
11 years, 3 months ago (2014-07-22 04:06:32 UTC) #3
*** Submitted as
https://code.google.com/p/goprotobuf/source/detail?r=616d4b420266 ***

goprotobuf: Split encoding of int32 and uint32 fields.

int32 needs special handling; negative values need to be sign-extended,
so need to be converted from uint32 back to int32 before converting to
uint64 for the varint encoding step (yielding 10 bytes).
uint32 is simpler and stays as just encoding the bit pattern,
and thus never takes more than 5 bytes.
This permits upgrading int32 fields to int64, and matches C++.

LGTM=nigeltao
R=nigeltao
CC=golang-codereviews
https://codereview.appspot.com/114190043
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b