rename utils.Min to utils.MinInt

This commit is contained in:
Marten Seemann 2022-07-25 15:46:21 -04:00
parent 2ea21b7b16
commit 424325af58
3 changed files with 5 additions and 5 deletions

View file

@ -42,8 +42,8 @@ func MinUint64(a, b uint64) uint64 {
return b
}
// Min returns the minimum of two Ints
func Min(a, b int) int {
// MinInt returns the minimum of two Ints
func MinInt(a, b int) int {
if a < b {
return a
}

View file

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

View file

@ -20,7 +20,7 @@ func newSingleOriginTokenStore(size int) *singleOriginTokenStore {
func (s *singleOriginTokenStore) Add(token *ClientToken) {
s.tokens[s.p] = token
s.p = s.index(s.p + 1)
s.len = utils.Min(s.len+1, len(s.tokens))
s.len = utils.MinInt(s.len+1, len(s.tokens))
}
func (s *singleOriginTokenStore) Pop() *ClientToken {