SetIndex sets the bit at index i within the bit array. The behavior is undefined if i >= bA.Bits
(i int, v bool)
| 65 | // SetIndex sets the bit at index i within the bit array. |
| 66 | // The behavior is undefined if i >= bA.Bits |
| 67 | func (bA *BitArray) SetIndex(i int, v bool) bool { |
| 68 | if bA == nil { |
| 69 | return false |
| 70 | } |
| 71 | bA.mtx.Lock() |
| 72 | defer bA.mtx.Unlock() |
| 73 | return bA.setIndex(i, v) |
| 74 | } |
| 75 | |
| 76 | func (bA *BitArray) setIndex(i int, v bool) bool { |
| 77 | if i >= bA.Bits { |