From 324779ad702fdef0cd3bd4e56ed0128ffaa6113e Mon Sep 17 00:00:00 2001 From: "pliard@google.com" Date: Fri, 2 Mar 2012 14:00:20 +0000 Subject: Remove static initializer in wire_format_lite.cc. --- src/google/protobuf/io/coded_stream.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/google/protobuf/io') diff --git a/src/google/protobuf/io/coded_stream.h b/src/google/protobuf/io/coded_stream.h index 1b6b4e18..97ac5079 100644 --- a/src/google/protobuf/io/coded_stream.h +++ b/src/google/protobuf/io/coded_stream.h @@ -680,6 +680,21 @@ class LIBPROTOBUF_EXPORT CodedOutputStream { // If negative, 10 bytes. Otheriwse, same as VarintSize32(). static int VarintSize32SignExtended(int32 value); + // Compile-time equivalent of VarintSize32(). + template + struct StaticVarintSize32 { + static const int value = + (Value < (1 << 7)) + ? 1 + : (Value < (1 << 14)) + ? 2 + : (Value < (1 << 21)) + ? 3 + : (Value < (1 << 28)) + ? 4 + : 5; + }; + // Returns the total number of bytes written since this object was created. inline int ByteCount() const; -- cgit v1.2.3