From d1e5bdf860d6d7ac3a8f3f8917bbae30f48d4fe5 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Tue, 14 Jul 2015 13:57:26 +0200 Subject: Change BitString internal representation --- ber/bits.go | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'ber/bits.go') diff --git a/ber/bits.go b/ber/bits.go index 107cd6b..3d1ca41 100644 --- a/ber/bits.go +++ b/ber/bits.go @@ -1,15 +1,17 @@ package ber // BitString -type Bits struct { - Bytes []byte - Length int -} +type Bits []bool func parseBitString(b []byte) (bs Bits) { padding := int(b[0]) - bs.Length = (len(b)-1)*8 - padding - bs.Bytes = b[1:] + length := (len(b)-1)*8 - padding + for i := 0; i < length; i++ { + x := 1 + i/8 + y := 7 - uint(i%8) + bit := b[x]&(1<