From ae2653ae9cd5ac97a7a495948394d59c07281639 Mon Sep 17 00:00:00 2001 From: Stephen Kitt Date: Wed, 22 Jul 2026 10:40:33 +0200 Subject: [PATCH] Reduce integer code and mark it inlinable This allows go fix to automatically replace any remaining uses with the recommended replacement code. Signed-off-by: Stephen Kitt --- integer/integer.go | 44 ++++++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/integer/integer.go b/integer/integer.go index f64d6495..812bfa33 100644 --- a/integer/integer.go +++ b/integer/integer.go @@ -20,60 +20,56 @@ import "math" // IntMax returns the maximum of the params. // Deprecated: for new code, use the max() builtin instead. +// +//go:fix inline func IntMax(a, b int) int { - if b > a { - return b - } - return a + return max(a, b) } // IntMin returns the minimum of the params. // Deprecated: for new code, use the min() builtin instead. +// +//go:fix inline func IntMin(a, b int) int { - if b < a { - return b - } - return a + return min(a, b) } // Int32Max returns the maximum of the params. // Deprecated: for new code, use the max() builtin instead. +// +//go:fix inline func Int32Max(a, b int32) int32 { - if b > a { - return b - } - return a + return max(a, b) } // Int32Min returns the minimum of the params. // Deprecated: for new code, use the min() builtin instead. +// +//go:fix inline func Int32Min(a, b int32) int32 { - if b < a { - return b - } - return a + return min(a, b) } // Int64Max returns the maximum of the params. // Deprecated: for new code, use the max() builtin instead. +// +//go:fix inline func Int64Max(a, b int64) int64 { - if b > a { - return b - } - return a + return max(a, b) } // Int64Min returns the minimum of the params. // Deprecated: for new code, use the min() builtin instead. +// +//go:fix inline func Int64Min(a, b int64) int64 { - if b < a { - return b - } - return a + return min(a, b) } // RoundToInt32 rounds floats into integer numbers. // Deprecated: use math.Round() and a cast directly. +// +//go:fix inline func RoundToInt32(a float64) int32 { return int32(math.Round(a)) }