(increment)
| 397889 | return (end-num)|0; |
| 397890 | } |
| 397891 | function _sbrk(increment) { |
| 397892 | increment = increment|0; |
| 397893 | var oldDynamicTop = 0; |
| 397894 | var oldDynamicTopOnChange = 0; |
| 397895 | var newDynamicTop = 0; |
| 397896 | var totalMemory = 0; |
| 397897 | increment = ((increment + 15) & -16)|0; |
| 397898 | oldDynamicTop = HEAP32[DYNAMICTOP_PTR>>2]|0; |
| 397899 | newDynamicTop = oldDynamicTop + increment | 0; |
| 397900 | |
| 397901 | if (((increment|0) > 0 & (newDynamicTop|0) < (oldDynamicTop|0)) // Detect and fail if we would wrap around signed 32-bit int. |
| 397902 | | (newDynamicTop|0) < 0) { // Also underflow, sbrk() should be able to be used to subtract. |
| 397903 | abortOnCannotGrowMemory()|0; |
| 397904 | ___setErrNo(12); |
| 397905 | return -1; |
| 397906 | } |
| 397907 | |
| 397908 | HEAP32[DYNAMICTOP_PTR>>2] = newDynamicTop; |
| 397909 | totalMemory = getTotalMemory()|0; |
| 397910 | if ((newDynamicTop|0) > (totalMemory|0)) { |
| 397911 | if ((enlargeMemory()|0) == 0) { |
| 397912 | HEAP32[DYNAMICTOP_PTR>>2] = oldDynamicTop; |
| 397913 | ___setErrNo(12); |
| 397914 | return -1; |
| 397915 | } |
| 397916 | } |
| 397917 | return oldDynamicTop|0; |
| 397918 | } |
| 397919 | |
| 397920 | |
| 397921 | function dynCall_i(index) { |
no test coverage detected
searching dependent graphs…