Skip to content

Commit 14653c7

Browse files
bnoordhuisFishrock123
authored andcommitted
stream: rename poorly named function
roundUpToNextPowerOf2() does more than just rounding up to the next power of two. Rename it to computeNewHighWaterMark(). PR-URL: #2479 Reviewed-By: Chris Dickinson <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]>
1 parent 1c6e014 commit 14653c7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/_stream_readable.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ Readable.prototype.setEncoding = function(enc) {
192192

193193
// Don't raise the hwm > 8MB
194194
const MAX_HWM = 0x800000;
195-
function roundUpToNextPowerOf2(n) {
195+
function computeNewHighWaterMark(n) {
196196
if (n >= MAX_HWM) {
197197
n = MAX_HWM;
198198
} else {
@@ -231,7 +231,7 @@ function howMuchToRead(n, state) {
231231
// power of 2, to prevent increasing it excessively in tiny
232232
// amounts.
233233
if (n > state.highWaterMark)
234-
state.highWaterMark = roundUpToNextPowerOf2(n);
234+
state.highWaterMark = computeNewHighWaterMark(n);
235235

236236
// don't have that much. return null, unless we've ended.
237237
if (n > state.length) {

0 commit comments

Comments
 (0)