mirror of https://github.com/lukechilds/node.git
Browse Source
Don't iterate over all 32 bits, use some hacker's delight bit twiddling to compute the next power of two. The logic can be reduced to `n = 1 << 32 - Math.clz32(n)` but then it can't easily be backported to v2.x; Math.clz32() was added in V8 4.3. PR-URL: https://github.com/nodejs/node/pull/2479 Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>v4.0.0-rc
Ben Noordhuis
9 years ago
1 changed files with 5 additions and 1 deletions
Loading…
Reference in new issue