mul and sqr optimizations