From 84564da2b4aabad6c322177a2c4fcd7538e93823 Mon Sep 17 00:00:00 2001 From: glenherb Date: Sat, 6 Aug 2016 16:41:29 -0500 Subject: [PATCH] Make IntComparator a bit more direct --- utils/comparator.go | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/utils/comparator.go b/utils/comparator.go index 9efab79c..5da01646 100644 --- a/utils/comparator.go +++ b/utils/comparator.go @@ -15,16 +15,7 @@ type Comparator func(a, b interface{}) int // IntComparator provides a basic comparison on ints func IntComparator(a, b interface{}) int { - aInt := a.(int) - bInt := b.(int) - switch { - case aInt > bInt: - return 1 - case aInt < bInt: - return -1 - default: - return 0 - } + return a.(int) - b.(int) } // StringComparator provides a fast comparison on strings