From 54caa4e7e085e177ff05b719ae247d21fe8c257e Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Sat, 26 Sep 2015 12:04:34 +0200 Subject: Replace with new implementation --- ber/bitstring.go | 93 -------------------------------------------------------- 1 file changed, 93 deletions(-) delete mode 100644 ber/bitstring.go (limited to 'ber/bitstring.go') diff --git a/ber/bitstring.go b/ber/bitstring.go deleted file mode 100644 index eabc354..0000000 --- a/ber/bitstring.go +++ /dev/null @@ -1,93 +0,0 @@ -package ber - -// BitString -type BitString []bool - -func UnmarshalBitString(b []byte) (bs BitString) { - padding := int(b[0]) - 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< 0 && i%4 == 0 { - s += " " - } - s += bmap[bit] - } - return -} - -func (bs BitString) IsSet(n int) bool { - if n > len(bs) { - return false - } - return bs[n] -} - -func pow2(n int) int { - i := 1 - for i < n+1 { - i <<= 1 - } - return i -} - -func (bs *BitString) Set(n int) { - if len(*bs) < n { - nbs := make(BitString, pow2(n)) - copy(nbs, *bs) - *bs = nbs - } - (*bs)[n] = true -} - -func (bs *BitString) Clear(n int) { - if len(*bs) < n { - nbs := make(BitString, pow2(n)) - copy(nbs, *bs) - *bs = nbs - } - (*bs)[n] = false -} - -func (bs BitString) Equal(s BitString) bool { - if len(bs) != len(s) { - return false - } - for i := 0; i < len(bs); i++ { - if bs[i] != s[i] { - return false - } - } - return true -} -- cgit v1.2.3