aboutsummaryrefslogtreecommitdiff
path: root/ber/marshal.go
diff options
context:
space:
mode:
Diffstat (limited to 'ber/marshal.go')
-rw-r--r--ber/marshal.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/ber/marshal.go b/ber/marshal.go
index 041cb1b..831ee5b 100644
--- a/ber/marshal.go
+++ b/ber/marshal.go
@@ -107,9 +107,10 @@ func (s *state) marshalBitString(val BitString) {
}
func (s *state) marshalClass(h Header) {
- buf := &state{}
- buf.marshalBase128(int(h.Tag))
- b := buf.Bytes()
- b[0] |= byte(h.Class) | byte(h.Kind)
- s.Write(b)
+ if h.Tag >= tagMask {
+ s.WriteByte(byte(h.Class) | byte(h.Kind) | byte(tagMask))
+ s.marshalBase128(int(h.Tag))
+ } else {
+ s.WriteByte(byte(h.Class) | byte(h.Kind) | byte(h.Tag))
+ }
}