diff options
author | Jon Skeet <skeet@pobox.com> | 2015-06-12 11:47:47 +0100 |
---|---|---|
committer | Jon Skeet <skeet@pobox.com> | 2015-06-12 11:47:47 +0100 |
commit | 5685e987112077b2df9fc59acfbfa30f1e3ea38b (patch) | |
tree | caae9a522a25d26a3511b3d80d638f8a1aea7adc /csharp/src | |
parent | 1b71db1180953e592e134ddd509f54d6024df593 (diff) | |
download | protobuf-5685e987112077b2df9fc59acfbfa30f1e3ea38b.tar.gz protobuf-5685e987112077b2df9fc59acfbfa30f1e3ea38b.tar.bz2 protobuf-5685e987112077b2df9fc59acfbfa30f1e3ea38b.zip |
Simplify ComputeInt32Size to call ComputeInt32SizeNoTag.
Diffstat (limited to 'csharp/src')
-rw-r--r-- | csharp/src/ProtocolBuffers/CodedOutputStream.ComputeSize.cs | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/csharp/src/ProtocolBuffers/CodedOutputStream.ComputeSize.cs b/csharp/src/ProtocolBuffers/CodedOutputStream.ComputeSize.cs index b7629d7c..aba5a1a2 100644 --- a/csharp/src/ProtocolBuffers/CodedOutputStream.ComputeSize.cs +++ b/csharp/src/ProtocolBuffers/CodedOutputStream.ComputeSize.cs @@ -91,15 +91,7 @@ namespace Google.Protobuf /// </summary>
public static int ComputeInt32Size(int fieldNumber, int value)
{
- if (value >= 0)
- {
- return ComputeTagSize(fieldNumber) + ComputeRawVarint32Size((uint) value);
- }
- else
- {
- // Must sign-extend.
- return ComputeTagSize(fieldNumber) + 10;
- }
+ return ComputeTagSize(fieldNumber) + ComputeInt32SizeNoTag(value);
}
/// <summary>
@@ -418,7 +410,6 @@ namespace Google.Protobuf /// </summary>
public static int ComputeRawVarint32Size(uint value)
{
- // TODO(jonskeet): Look at optimizing this to just hard-coded comparisons.
if ((value & (0xffffffff << 7)) == 0)
{
return 1;
@@ -443,7 +434,6 @@ namespace Google.Protobuf /// </summary>
public static int ComputeRawVarint64Size(ulong value)
{
- // TODO(jonskeet): Look at optimizing this to just hard-coded comparisons.
if ((value & (0xffffffffffffffffL << 7)) == 0)
{
return 1;
|