MCPcopy
hub / github.com/canopy-network/canopy / Recycle

Method Recycle

lib/crypto/classgroup.go:569–590  ·  view source on GitHub ↗

Recycle releases a big.int to the pool

(ints ...*big.Int)

Source from the content-addressed store, hash-verified

567
568// Recycle releases a big.int to the pool
569func (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
593var Residues = []int{

Callers 13

newClassGroupFunction · 0.80
MultiplyMethod · 0.80
BigPowMethod · 0.80
SquareMethod · 0.80
NormalizedMethod · 0.80
ReducedMethod · 0.80
DiscriminantMethod · 0.80
DiscardMethod · 0.80
encodeBigIntFunction · 0.80
floorDivisionFunction · 0.80
safeGCDFunction · 0.80
verifyProofFunction · 0.80

Calls 2

LockMethod · 0.80
UnlockMethod · 0.80

Tested by

no test coverage detected