Unverified Commit e8a991d6 authored by Steven Allen's avatar Steven Allen Committed by GitHub

Merge pull request #2 from libp2p/kevina/fix-32-bit-overflow

Fix overflow on 32-bit platforms.
parents 1d28ab5f 2ad47e56
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
package pool package pool
import ( import (
"math"
"math/bits" "math/bits"
"sync" "sync"
) )
...@@ -29,7 +30,7 @@ import ( ...@@ -29,7 +30,7 @@ import (
var GlobalPool = new(BufferPool) var GlobalPool = new(BufferPool)
// MaxLength is the maximum length of an element that can be added to the Pool. // MaxLength is the maximum length of an element that can be added to the Pool.
const MaxLength = 1 << 32 const MaxLength = math.MaxInt32
// BufferPool is a pool to handle cases of reusing elements of varying sizes. It // BufferPool is a pool to handle cases of reusing elements of varying sizes. It
// maintains 32 internal pools, for each power of 2 in 0-32. // maintains 32 internal pools, for each power of 2 in 0-32.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment