Skip to content

Commit 888d4b7

Browse files
committed
p2p: using math.MaxInt32 in go std lib
1 parent 792de5d commit 888d4b7

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

p2p/msgrate/msgrate.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,7 @@ func (t *Tracker) Capacity(kind uint64, targetRTT time.Duration) int {
171171
// roundCapacity gives the integer value of a capacity.
172172
// The result fits int32, and is guaranteed to be positive.
173173
func roundCapacity(cap float64) int {
174-
const maxInt32 = float64(1<<31 - 1)
175-
return int(math.Min(maxInt32, math.Max(1, math.Ceil(cap))))
174+
return int(math.Min(math.MaxInt32, math.Max(1, math.Ceil(cap))))
176175
}
177176

178177
// Update modifies the peer's capacity values for a specific data type with a new

0 commit comments

Comments
 (0)