OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 class WireFormat { |
| 6 |
| 7 static final int TAG_TYPE_BITS = 3; |
| 8 static final int TAG_TYPE_MASK = (1 << TAG_TYPE_BITS) - 1; |
| 9 |
| 10 static final int WIRETYPE_VARINT = 0; |
| 11 static final int WIRETYPE_FIXED64 = 1; |
| 12 static final int WIRETYPE_LENGTH_DELIMITED = 2; |
| 13 static final int WIRETYPE_START_GROUP = 3; |
| 14 static final int WIRETYPE_END_GROUP = 4; |
| 15 static final int WIRETYPE_FIXED32 = 5; |
| 16 |
| 17 static int getTagFieldNumber(int tag) { |
| 18 return (tag & 0x7fffffff) >> TAG_TYPE_BITS; // >>> |
| 19 } |
| 20 |
| 21 static int getTagWireType(final int tag) { |
| 22 return tag & TAG_TYPE_MASK; |
| 23 } |
| 24 |
| 25 static int makeTag(int fieldNumber, final int wireType) { |
| 26 return (fieldNumber << TAG_TYPE_BITS) | wireType; |
| 27 } |
| 28 } |
OLD | NEW |