diff --git a/bitset.go b/bitset.go index bbb75ff..26cd6e4 100644 --- a/bitset.go +++ b/bitset.go @@ -1220,7 +1220,7 @@ func (b *BitSet) ShiftLeft(bits uint) { } // capacity check - if top+bits >= Cap() { + if top+bits < bits { panic("You are exceeding the capacity") } @@ -1230,7 +1230,7 @@ func (b *BitSet) ShiftLeft(bits uint) { // not using extendSet() to avoid unneeded data copying nsize := wordsNeeded(top + bits) if len(b.set) < nsize { - dst = make([]uint64, nsize, 2*nsize) + dst = make([]uint64, nsize) } if top+bits >= b.length { b.length = top + bits + 1