Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Unified Diff: lib/protobuf/runtime/WireFormat.dart

Issue 10595002: Protocol Buffer runtime library and 'protoc' plugin (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Work around http://code.google.com/p/dart/issues/detail?id=3806 Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/protobuf/runtime/UnknownFieldSet.dart ('k') | lib/protobuf/runtime/mock_io.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/protobuf/runtime/WireFormat.dart
diff --git a/lib/protobuf/runtime/WireFormat.dart b/lib/protobuf/runtime/WireFormat.dart
new file mode 100644
index 0000000000000000000000000000000000000000..941d88a1065ff6f4f6bfc29e95a3bb26f9e8a9c5
--- /dev/null
+++ b/lib/protobuf/runtime/WireFormat.dart
@@ -0,0 +1,28 @@
+// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+class WireFormat {
+
+ static final int TAG_TYPE_BITS = 3;
+ static final int TAG_TYPE_MASK = (1 << TAG_TYPE_BITS) - 1;
+
+ static final int WIRETYPE_VARINT = 0;
+ static final int WIRETYPE_FIXED64 = 1;
+ static final int WIRETYPE_LENGTH_DELIMITED = 2;
+ static final int WIRETYPE_START_GROUP = 3;
+ static final int WIRETYPE_END_GROUP = 4;
+ static final int WIRETYPE_FIXED32 = 5;
+
+ static int getTagFieldNumber(int tag) {
+ return (tag & 0x7fffffff) >> TAG_TYPE_BITS; // >>>
+ }
+
+ static int getTagWireType(final int tag) {
+ return tag & TAG_TYPE_MASK;
+ }
+
+ static int makeTag(int fieldNumber, final int wireType) {
+ return (fieldNumber << TAG_TYPE_BITS) | wireType;
+ }
+}
« no previous file with comments | « lib/protobuf/runtime/UnknownFieldSet.dart ('k') | lib/protobuf/runtime/mock_io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698