MCPcopy Create free account
hub / github.com/TruthHun/BookStack / computeNewHighWaterMark

Function computeNewHighWaterMark

static/word2md/mammoth.browser.js:24410–24425  ·  view source on GitHub ↗
(n)

Source from the content-addressed store, hash-verified

24408// Don't raise the hwm > 8MB
24409var MAX_HWM = 0x800000;
24410function computeNewHighWaterMark(n) {
24411 if (n >= MAX_HWM) {
24412 n = MAX_HWM;
24413 } else {
24414 // Get the next highest power of 2 to prevent increasing hwm excessively in
24415 // tiny amounts
24416 n--;
24417 n |= n >>> 1;
24418 n |= n >>> 2;
24419 n |= n >>> 4;
24420 n |= n >>> 8;
24421 n |= n >>> 16;
24422 n++;
24423 }
24424 return n;
24425}
24426
24427// This function is designed to be inlinable, so please take care when making
24428// changes to the function body.

Callers 1

howMuchToReadFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected