func (s *Bitset) SetTo(index uint, value bool) *Bitset {
	if value {
		return s.Set(index)
	}
	return s.Unset(index)
}
SetTo set index bit to 1 if value is true, otherwise 0
package bitset
const (
	Uint0       uint   = 0
	unitLenLogN        = 6  
	unitLen            = 1 << unitLenLogN
	unitMax     uint64 = 1<<unitLen - 1
)
func newUnits(count uint) []uint64 {
	return make([]uint64, count)
}
func unitCount(length uint) uint {
	count := length >> unitLenLogN
	if length&(unitLen-1) != 0 {
		count++
	}
	return count
}
func unitPos(index uint) uint {
	return index >> unitLenLogN
}
func unitIndex(index uint) uint {
	return index & (unitLen - 1)
}
type Bitset struct {
	length uint      
	set    []uint64  
}
func nonZeroLen(l uint) {
	if l == 0 {
		panic("length should not be zero")
	}
}
func NewBitset(length uint, indexs ...uint) *Bitset {
	nonZeroLen(length)
	s := &Bitset{
		length: length,
		set:    newUnits(unitCount(length)),
	}
	for _, i := range indexs {
		s.Set(i)
	}
	return s
}
func (s *Bitset) Set(index uint) *Bitset {
	s.extend(index)
	s.set[unitPos(index)] |= 1 << unitIndex(index)
	return s
}
func (s *Bitset) SetAll() *Bitset {
	return s.unitOp(func(s *Bitset, i int) {
		s.set[i] = unitMax
	})
}
func (s *Bitset) Unset(index uint) *Bitset {
	s.extend(index)
	s.set[unitPos(index)] &= ^(1 << unitIndex(index))
	return s
}
func (s *Bitset) UnsetAll() *Bitset {
	return s.unitOp(func(s *Bitset, i int) {
		s.set[i] = 0
	})
}
func (s *Bitset) Flip(index uint) *Bitset {
	if index >= s.Length(0) {
		s.Set(index)
	}
	s.set[unitPos(index)] ^= 1 << unitIndex(index)
	return s
}
func (s *Bitset) FlipAll() *Bitset {
	return s.unitOp(func(s *Bitset, i int) {
		s.set[i] = ^s.set[i]
	})
}
func (s *Bitset) Except(index ...uint) *Bitset {
	s.SetAll()
	for _, i := range index {
		s.Unset(i)
	}
	return s
}
func (s *Bitset) IsSet(index uint) bool {
	return index < s.Length(0) && (s.set[unitPos(index)]&(1<<unitIndex(index))) != 0
}