aboutsummaryrefslogtreecommitdiff
path: root/ber
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-06-27 23:32:24 +0200
committerDimitri Sokolyuk <demon@dim13.org>2015-06-27 23:32:24 +0200
commitf23bb736ab87c45e473d1f502f523e8d7ecd3379 (patch)
tree057c64ff15474c8639f2d183f16e311590ca7829 /ber
parent83744f5d7068c4af05783a5c8ce3851b24c4452d (diff)
Hide Masks
Diffstat (limited to 'ber')
-rw-r--r--ber/class.go19
1 files changed, 4 insertions, 15 deletions
diff --git a/ber/class.go b/ber/class.go
index b3a0ebf..04a796a 100644
--- a/ber/class.go
+++ b/ber/class.go
@@ -7,12 +7,9 @@ const (
Application
ContextSpecific
Private
+ classMask Class = 3 << 6
)
-// 1100 0000
-// C 0
-const ClassMask Class = 3 << 6
-
var classNames = map[Class]string{
Universal: "Universal",
Application: "Application",
@@ -27,12 +24,9 @@ type Kind byte
const (
Primitive Kind = iota << 5
Constructed
+ kindMask Kind = 1 << 5
)
-// 0010 0000
-// 2 0
-const KindMask Kind = 1 << 5
-
var kindNames = map[Kind]string{
Primitive: "Primitive",
Constructed: "Constructed",
@@ -74,12 +68,9 @@ const (
UniversalString
CharacterString
BMPString
+ tagMask Tag = (1 << 5) - 1
)
-// 0001 1111
-// 1 F
-const TagMask Tag = 0x20 - 1
-
var tagNames = map[Tag]string{
EOT: "End-of-Content",
Boolean: "Boolean",
@@ -115,7 +106,5 @@ var tagNames = map[Tag]string{
func (t Tag) String() string { return tagNames[t] }
func Ident(b byte) (Class, Kind, Tag) {
- return Class(b) & ClassMask,
- Kind(b) & KindMask,
- Tag(b) & TagMask
+ return Class(b) & classMask, Kind(b) & kindMask, Tag(b) & tagMask
}