From f540a7a9e07228520e7a5c1a233ac8fc463138d4 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Mon, 5 Oct 2015 20:45:31 +0200 Subject: Minor cleanup --- ber/marshal.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'ber') 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)) } } -- cgit v1.2.3