Prefer primitive math, less casts.

Thanks for your help, ztellman !