optimized int part

optimization in code. and when combined with gcc -O3 flag, the speed gain is amazing.