]>
Commit | Line | Data |
---|---|---|
1 | package codes | |
2 | ||
3 | type Code byte | |
4 | ||
5 | var ( | |
6 | PosFixedNumHigh Code = 0x7f | |
7 | NegFixedNumLow Code = 0xe0 | |
8 | ||
9 | Nil Code = 0xc0 | |
10 | ||
11 | False Code = 0xc2 | |
12 | True Code = 0xc3 | |
13 | ||
14 | Float Code = 0xca | |
15 | Double Code = 0xcb | |
16 | ||
17 | Uint8 Code = 0xcc | |
18 | Uint16 Code = 0xcd | |
19 | Uint32 Code = 0xce | |
20 | Uint64 Code = 0xcf | |
21 | ||
22 | Int8 Code = 0xd0 | |
23 | Int16 Code = 0xd1 | |
24 | Int32 Code = 0xd2 | |
25 | Int64 Code = 0xd3 | |
26 | ||
27 | FixedStrLow Code = 0xa0 | |
28 | FixedStrHigh Code = 0xbf | |
29 | FixedStrMask Code = 0x1f | |
30 | Str8 Code = 0xd9 | |
31 | Str16 Code = 0xda | |
32 | Str32 Code = 0xdb | |
33 | ||
34 | Bin8 Code = 0xc4 | |
35 | Bin16 Code = 0xc5 | |
36 | Bin32 Code = 0xc6 | |
37 | ||
38 | FixedArrayLow Code = 0x90 | |
39 | FixedArrayHigh Code = 0x9f | |
40 | FixedArrayMask Code = 0xf | |
41 | Array16 Code = 0xdc | |
42 | Array32 Code = 0xdd | |
43 | ||
44 | FixedMapLow Code = 0x80 | |
45 | FixedMapHigh Code = 0x8f | |
46 | FixedMapMask Code = 0xf | |
47 | Map16 Code = 0xde | |
48 | Map32 Code = 0xdf | |
49 | ||
50 | FixExt1 Code = 0xd4 | |
51 | FixExt2 Code = 0xd5 | |
52 | FixExt4 Code = 0xd6 | |
53 | FixExt8 Code = 0xd7 | |
54 | FixExt16 Code = 0xd8 | |
55 | Ext8 Code = 0xc7 | |
56 | Ext16 Code = 0xc8 | |
57 | Ext32 Code = 0xc9 | |
58 | ) | |
59 | ||
60 | func IsFixedNum(c Code) bool { | |
61 | return c <= PosFixedNumHigh || c >= NegFixedNumLow | |
62 | } | |
63 | ||
64 | func IsFixedMap(c Code) bool { | |
65 | return c >= FixedMapLow && c <= FixedMapHigh | |
66 | } | |
67 | ||
68 | func IsFixedArray(c Code) bool { | |
69 | return c >= FixedArrayLow && c <= FixedArrayHigh | |
70 | } | |
71 | ||
72 | func IsFixedString(c Code) bool { | |
73 | return c >= FixedStrLow && c <= FixedStrHigh | |
74 | } | |
75 | ||
76 | func IsString(c Code) bool { | |
77 | return IsFixedString(c) || c == Str8 || c == Str16 || c == Str32 | |
78 | } | |
79 | ||
80 | func IsFixedExt(c Code) bool { | |
81 | return c >= FixExt1 && c <= FixExt16 | |
82 | } | |
83 | ||
84 | func IsExt(c Code) bool { | |
85 | return IsFixedExt(c) || c == Ext8 || c == Ext16 || c == Ext32 | |
86 | } |