func (bA *BitArray) SetIndex(i int, v bool) bool {
	if bA == nil {
		return false
	}
	bA.mtx.Lock()
	defer bA.mtx.Unlock()
	return bA.setIndex(uint(i), v)
}
SetIndex sets the bit at index i within the bit array.
The behavior is undefined if i >= bA.Bits
package types
import (
	"encoding/binary"
	"fmt"
	"regexp"
	"strings"
	"sync"
)
type BitArray struct {
	mtx   sync.Mutex
	Bits  uint     `json:"bits"`   
	Elems []uint64 `json:"elems"`  
}
func NewBitArray(bits int) *BitArray {
	if bits <= 0 {
		return nil
	}
	return &BitArray{
		Bits:  uint(bits),
		Elems: make([]uint64, (bits+63)/64),
	}
}
func (bA *BitArray) Size() uint {
	if bA == nil {
		return 0
	}
	return bA.Bits
}
func (bA *BitArray) GetIndex(i int) bool {
	if bA == nil {
		return false
	}
	bA.mtx.Lock()
	defer bA.mtx.Unlock()
	return bA.getIndex(uint(i))
}
func (bA *BitArray) getIndex(i uint) bool {
	if i >= bA.Bits {
		return false
	}
	return bA.Elems[i/64]&(uint64(1)<<uint(i%64)) > 0
}