diff options
Diffstat (limited to 'ber')
-rw-r--r-- | ber/marshal.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/ber/marshal.go b/ber/marshal.go index 831ee5b..2808269 100644 --- a/ber/marshal.go +++ b/ber/marshal.go @@ -107,10 +107,11 @@ func (s *state) marshalBitString(val BitString) { } func (s *state) marshalClass(h Header) { - if h.Tag >= tagMask { - s.WriteByte(byte(h.Class) | byte(h.Kind) | byte(tagMask)) - s.marshalBase128(int(h.Tag)) + head := byte(h.Class) | byte(h.Kind) + if h.Tag < tagMask { + s.WriteByte(head | byte(h.Tag)) } else { - s.WriteByte(byte(h.Class) | byte(h.Kind) | byte(h.Tag)) + s.WriteByte(head | byte(tagMask)) + s.marshalBase128(int(h.Tag)) } } |