Update sets the bA's bits to be that of the other bit array. The copying begins from the begin of both bit arrays.
(o *BitArray)
| 357 | // Update sets the bA's bits to be that of the other bit array. |
| 358 | // The copying begins from the begin of both bit arrays. |
| 359 | func (bA *BitArray) Update(o *BitArray) { |
| 360 | if bA == nil || o == nil { |
| 361 | return |
| 362 | } |
| 363 | |
| 364 | bA.mtx.Lock() |
| 365 | o.mtx.Lock() |
| 366 | copy(bA.Elems, o.Elems) |
| 367 | o.mtx.Unlock() |
| 368 | bA.mtx.Unlock() |
| 369 | } |
| 370 | |
| 371 | // MarshalJSON implements json.Marshaler interface by marshaling bit array |
| 372 | // using a custom format: a string of '-' or 'x' where 'x' denotes the 1 bit. |