From 8b2ca579d8274fe8ce3b2d30165c99066762c73a Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Tue, 7 Jul 2015 22:49:52 +0200 Subject: Add BitString --- ber/bits.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 ber/bits.go (limited to 'ber/bits.go') diff --git a/ber/bits.go b/ber/bits.go new file mode 100644 index 0000000..42474e5 --- /dev/null +++ b/ber/bits.go @@ -0,0 +1,18 @@ +package ber + +// BitString +type Bits struct { + Bytes []byte + Length int +} + +func parseBitString(b []byte) (bs Bits) { + padding := int(b[0]) + bs.Length = (len(b)-1)*8 - padding + bs.Bytes = b[1:] + return +} + +func UnmarshalBitString(b []byte) Bits { + return parseBitString(b) +} -- cgit v1.2.3