Recycle releases a big.int to the pool
(ints ...*big.Int)
| 567 | |
| 568 | // Recycle releases a big.int to the pool |
| 569 | func (bp *BigIntPool) Recycle(ints ...*big.Int) { |
| 570 | bp.mu.Lock() |
| 571 | defer bp.mu.Unlock() |
| 572 | // get the size of the pool |
| 573 | size := len(bp.free) |
| 574 | // for each big int |
| 575 | for _, b := range ints { |
| 576 | // don't allow growth past the max size |
| 577 | if size >= bp.maxSize { |
| 578 | return |
| 579 | } |
| 580 | // only set non nil big ints |
| 581 | if b != nil { |
| 582 | // reset the big int |
| 583 | b.SetInt64(0) |
| 584 | // add to the list |
| 585 | bp.free = append(bp.free, b) |
| 586 | } |
| 587 | // increment the size |
| 588 | size++ |
| 589 | } |
| 590 | } |
| 591 | |
| 592 | // Public to allow others to import |
| 593 | var Residues = []int{ |
no test coverage detected