rename utils.Max to utils.MaxInt

This commit is contained in:
Marten Seemann
2022-07-25 15:41:48 -04:00
parent ea9de26ed5
commit 2ea21b7b16
3 changed files with 5 additions and 5 deletions

View File

@@ -10,8 +10,8 @@ import (
// InfDuration is a duration of infinite length
const InfDuration = time.Duration(math.MaxInt64)
// Max returns the maximum of two Ints
func Max(a, b int) int {
// MaxInt returns the maximum of two Ints
func MaxInt(a, b int) int {
if a < b {
return b
}

View File

@@ -11,8 +11,8 @@ import (
var _ = Describe("Min / Max", func() {
Context("Max", func() {
It("returns the maximum", func() {
Expect(Max(5, 7)).To(Equal(7))
Expect(Max(7, 5)).To(Equal(7))
Expect(MaxInt(5, 7)).To(Equal(7))
Expect(MaxInt(7, 5)).To(Equal(7))
})
It("returns the maximum uint32", func() {

View File

@@ -27,7 +27,7 @@ func (s *singleOriginTokenStore) Pop() *ClientToken {
s.p = s.index(s.p - 1)
token := s.tokens[s.p]
s.tokens[s.p] = nil
s.len = utils.Max(s.len-1, 0)
s.len = utils.MaxInt(s.len-1, 0)
return token
}