fe_sub(r.T, t0, r.T)
}
-const ge_add_precomp_t0: FieldElement = fe()
/**
- * r = p + q
+ * `r = p + q`
+ *
+ * `p.Z` is doubled and stored to itself because its value is not referenced
+ * again before being reassigned at all three call sites of this function.
*/
//@ts-expect-error
@inline
export function ge_add_precomp (r: ge_p1p1, p: ge_p3, q: ge_precomp): void {
- const t0 = ge_add_precomp_t0
fe_add(r.X, p.Y, p.X)
fe_sub(r.Y, p.Y, p.X)
fe_mul(r.Z, r.X, q.yplusx)
fe_mul(r.Y, r.Y, q.yminusx)
fe_mul(r.T, q.xy2d, p.T)
- fe_dbl(t0, p.Z)
+ fe_dbl(p.Z, p.Z)
fe_sub(r.X, r.Z, r.Y)
fe_add(r.Y, r.Z, r.Y)
- fe_add(r.Z, t0, r.T)
- fe_sub(r.T, t0, r.T)
+ fe_add(r.Z, p.Z, r.T)
+ fe_sub(r.T, p.Z, r.T)
}
const ge_sub_p3_q_cached = new ge_cached()