diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js index 644c4ffa67b04f..766577af580ca4 100644 --- a/lib/_stream_readable.js +++ b/lib/_stream_readable.js @@ -198,7 +198,11 @@ function roundUpToNextPowerOf2(n) { } else { // Get the next highest power of 2 n--; - for (var p = 1; p < 32; p <<= 1) n |= n >> p; + n |= n >>> 1; + n |= n >>> 2; + n |= n >>> 4; + n |= n >>> 8; + n |= n >>> 16; n++; } return n;