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

Function roundUpToNextPowerOf2

MathBox/mathbox-core.js:3153–3163  ·  view source on GitHub ↗
(n)

Source from the content-addressed store, hash-verified

3151// Don't raise the hwm > 128MB
3152var MAX_HWM = 0x800000;
3153function roundUpToNextPowerOf2(n) {
3154 if (n >= MAX_HWM) {
3155 n = MAX_HWM;
3156 } else {
3157 // Get the next highest power of 2
3158 n--;
3159 for (var p = 1; p < 32; p <<= 1) n |= n >> p;
3160 n++;
3161 }
3162 return n;
3163}
3164
3165function howMuchToRead(n, state) {
3166 if (state.length === 0 && state.ended)

Callers 1

howMuchToReadFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected