freakyzoidberg commented on code in PR #29:
URL: https://github.com/apache/datasketches-go/pull/29#discussion_r2001721213


##########
cpc/pair_table.go:
##########
@@ -237,3 +237,63 @@ func mergePairs(arrA []int, startA, lengthA int, arrB 
[]int, startB, lengthB int
                c++
        }
 }
+
+// Copy creates and returns a deep copy of the pairTable.
+func (p *pairTable) Copy() *pairTable {
+       // Create a new pairTable using the same lgSizeInts and validBits.
+       newPT, err := NewPairTable(p.lgSizeInts, p.validBits)
+       if err != nil {
+               // This should not happen if p is valid.
+               panic(err)
+       }
+       // Copy the number of pairs.
+       newPT.numPairs = p.numPairs
+       // Deep copy the slots array.
+       newPT.slotsArr = make([]int, len(p.slotsArr))
+       copy(newPT.slotsArr, p.slotsArr)
+       return newPT
+}
+
+// UnwrapItems extracts the valid items from the pair table using the 
unwrapping logic.
+// It returns a slice containing exactly numPairs items, or nil if numPairs < 
1.
+func (p *pairTable) UnwrapItems(numPairs int) []int {

Review Comment:
   unwrap



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@datasketches.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@datasketches.apache.org
For additional commands, e-mail: dev-h...@datasketches.apache.org

Reply via email to