Clean up bytes to memory pages computations. Fix number overflow errors for very large memory sizes.