aboutsummaryrefslogtreecommitdiffhomepage
path: root/pyecsca/codegen/templates/formula_neg.c
diff options
context:
space:
mode:
authorJ08nY2020-02-20 15:06:18 +0100
committerJ08nY2020-02-20 15:06:18 +0100
commit92cb16e8103da998aa1bf226d24ef6771a92c5d5 (patch)
tree760e5f4921e8813b29748e7353a32168d99140cc /pyecsca/codegen/templates/formula_neg.c
parent5da1d167c203395103d220c450e29fece08f4198 (diff)
downloadpyecsca-codegen-92cb16e8103da998aa1bf226d24ef6771a92c5d5.tar.gz
pyecsca-codegen-92cb16e8103da998aa1bf226d24ef6771a92c5d5.tar.zst
pyecsca-codegen-92cb16e8103da998aa1bf226d24ef6771a92c5d5.zip
Allocate and initialize formula variables only once.
Diffstat (limited to 'pyecsca/codegen/templates/formula_neg.c')
-rw-r--r--pyecsca/codegen/templates/formula_neg.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/pyecsca/codegen/templates/formula_neg.c b/pyecsca/codegen/templates/formula_neg.c
index fc790de..c728e70 100644
--- a/pyecsca/codegen/templates/formula_neg.c
+++ b/pyecsca/codegen/templates/formula_neg.c
@@ -1,3 +1,10 @@
+#include "point.h"
+{% import "ops.c" as ops %}
+
+{{ ops.render_static_init(allocations, initializations, formula.shortname) }}
+
+{{ ops.render_static_clear(frees, formula.shortname) }}
+
void point_neg(const point_t *one, const curve_t *curve, point_t *out_one) {
{%- if short_circuit %}
if (point_equals(one, curve->neutral)) {
@@ -5,5 +12,6 @@ void point_neg(const point_t *one, const curve_t *curve, point_t *out_one) {
return;
}
{%- endif %}
- {%- include "ops.c" %}
+ {{ ops.render_ops(operations) }}
+ {{ ops.render_returns(returns) }}
} \ No newline at end of file