Skip to content

Commit

Permalink
Make IntComparator a bit more direct
Browse files Browse the repository at this point in the history
  • Loading branch information
glenherb authored Aug 6, 2016
1 parent 7f89ed3 commit 84564da
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions utils/comparator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 84564da

Please sign in to comment.