(n)
| 49836 | // Don't raise the hwm > 128MB |
| 49837 | var MAX_HWM = 0x800000; |
| 49838 | function 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 | |
| 49850 | function howMuchToRead(n, state) { |
| 49851 | if (state.length === 0 && state.ended) |