diff --git a/count/count_min_sketch.go b/count/count_min_sketch.go index 7bc927d..30dd99d 100644 --- a/count/count_min_sketch.go +++ b/count/count_min_sketch.go @@ -145,7 +145,7 @@ func (c *CountMinSketch) GetEstimate(item []byte) int64 { hashLocations := c.getHashes(item) estimate := int64(math.MaxInt64) for _, h := range hashLocations { - estimate = Min(estimate, c.sketchSlice[h]) + estimate = min(estimate, c.sketchSlice[h]) } return estimate } diff --git a/count/utils.go b/count/utils.go index eafb0e6..da7c25c 100644 --- a/count/utils.go +++ b/count/utils.go @@ -20,17 +20,8 @@ package count import ( "errors" "math" - - "golang.org/x/exp/constraints" ) -func Min[T constraints.Ordered](a, b T) T { - if a < b { - return a - } - return b -} - func SuggestNumBuckets(relativeError float64) (int32, error) { if relativeError <= 0 { return 0, errors.New("relative error must be greater than 0.0") @@ -42,7 +33,7 @@ func SuggestNumHashes(confidence float64) (int8, error) { if confidence < 0 || confidence > 1.0 { return 0, errors.New("confidence must be between 0 and 1.0 (inclusive)") } - return Min(int8(math.Ceil(math.Log(1.0/(1.0-confidence)))), int8(math.MaxInt8)), nil + return min(int8(math.Ceil(math.Log(1.0/(1.0-confidence)))), int8(math.MaxInt8)), nil } func checkHeaderValidity(preamble, serVer, familyID, flagsByte byte) error {