document why the cast to int can no longer overflow an int
diff --git a/client.go b/client.go
index 4b5ca46..f9bc5ce 100644
--- a/client.go
+++ b/client.go
@@ -1184,6 +1184,7 @@
if concurrency64 > uint64(f.c.maxConcurrentRequests) || concurrency64 < 1 {
concurrency64 = uint64(f.c.maxConcurrentRequests)
}
+ // Now that concurrency64 is saturated to an int value, we know this assignment cannot possibly overflow.
concurrency := int(concurrency64)
cancel := make(chan struct{})
@@ -1524,6 +1525,7 @@
if concurrency64 > int64(f.c.maxConcurrentRequests) || concurrency64 < 1 {
concurrency64 = int64(f.c.maxConcurrentRequests)
}
+ // Now that concurrency64 is saturated to an int value, we know this assignment cannot possibly overflow.
concurrency := int(concurrency64)
pool := newBufPool(concurrency, f.c.maxPacket)