Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
runtime: improve runtime.overLoadFactor calculation #20195
runtime.overLoadFactor could use some improvement.
First, a bug: uintptr is 32 bits wide on a 32 bit system, so calculating uintptr(1<<B) can overflow when B >= 32. That's Go 1.9 material, and I'll send a CL shortly. Maybe even 1.8.2, given the devastating result (infinite loop) and simplicity of fix. Marking 1.8.2 for discussion.
Second, an improvement: We should rewrite this to use integer arithmetic and pay more careful attention to potential overflow. That should probably wait for Go 1.10.
Exposed by CL 40854 when working with a hint of