MCPcopy Index your code
hub / github.com/stemkoski/stemkoski.github.com / roundUpToNextPowerOf2

Function roundUpToNextPowerOf2

MathBox/mathbox-bundle.js:49838–49848  ·  view source on GitHub ↗
(n)

Source from the content-addressed store, hash-verified

49836// Don't raise the hwm > 128MB
49837var MAX_HWM = 0x800000;
49838function roundUpToNextPowerOf2(n) {
49839 if (n >= MAX_HWM) {
49840 n = MAX_HWM;
49841 } else {
49842 // Get the next highest power of 2
49843 n--;
49844 for (var p = 1; p < 32; p <<= 1) n |= n >> p;
49845 n++;
49846 }
49847 return n;
49848}
49849
49850function howMuchToRead(n, state) {
49851 if (state.length === 0 && state.ended)

Callers 1

howMuchToReadFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected