Revert "IOBuffer: Optimise and fix range checks."
This reverts commit 91460a41b2b68b9d745827a07b6762adc99e3ed9.
This introduced several errors, including some that causes buffer overruns.
It also made the code biger on average (just check using size).
Please do not change the math unless you are very certain it will
Also, please trust the compiler, both to unroll loops even if it does
not make sense and to optimize obvious comparisons, yes?
Obvious example: check_avail_mul suddenly is pointless.
The whole idea with that function is to _safely_ check if A*B is bigger than the buffer.
Consider A*B >being > NATIVE_INT_MAX.