Skip to content

Commit

Permalink
stream: rename poorly named function
Browse files Browse the repository at this point in the history
roundUpToNextPowerOf2() does more than just rounding up to the next
power of two.  Rename it to computeNewHighWaterMark().

PR-URL: #2479
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
  • Loading branch information
bnoordhuis authored and Fishrock123 committed Aug 24, 2015
1 parent 1c6e014 commit 14653c7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/_stream_readable.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ Readable.prototype.setEncoding = function(enc) {

// Don't raise the hwm > 8MB
const MAX_HWM = 0x800000;
function roundUpToNextPowerOf2(n) {
function computeNewHighWaterMark(n) {
if (n >= MAX_HWM) {
n = MAX_HWM;
} else {
Expand Down Expand Up @@ -231,7 +231,7 @@ function howMuchToRead(n, state) {
// power of 2, to prevent increasing it excessively in tiny
// amounts.
if (n > state.highWaterMark)
state.highWaterMark = roundUpToNextPowerOf2(n);
state.highWaterMark = computeNewHighWaterMark(n);

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

0 comments on commit 14653c7

Please sign in to comment.