curve: speed up addition and doubling