diff --git a/src/gen_headers/decaf_h.py b/src/gen_headers/decaf_h.py index 8978e98..ceddec0 100644 --- a/src/gen_headers/decaf_h.py +++ b/src/gen_headers/decaf_h.py @@ -55,7 +55,7 @@ struct %(c_ns)s_precomputed_s; typedef struct %(c_ns)s_precomputed_s %(c_ns)s_precomputed_s; /** Size and alignment of precomputed point tables. */ -extern const size_t sizeof_%(c_ns)s_precomputed_s API_VIS, alignof_%(c_ns)s_precomputed_s API_VIS; +extern const size_t %(c_ns)s_sizeof_precomputed_s API_VIS, %(c_ns)s_alignof_precomputed_s API_VIS; /** Scalar is stored packed, because we don't need the speed. */ typedef struct %(c_ns)s_scalar_s { diff --git a/src/gen_headers/decaf_hxx.py b/src/gen_headers/decaf_hxx.py index 735bc8e..94a91e3 100644 --- a/src/gen_headers/decaf_hxx.py +++ b/src/gen_headers/decaf_hxx.py @@ -571,8 +571,8 @@ public: public: /** @cond internal */ friend class OwnedOrUnowned; - static inline size_t size() NOEXCEPT { return sizeof_%(c_ns)s_precomputed_s; } - static inline size_t alignment() NOEXCEPT { return alignof_%(c_ns)s_precomputed_s; } + static inline size_t size() NOEXCEPT { return %(c_ns)s_sizeof_precomputed_s; } + static inline size_t alignment() NOEXCEPT { return %(c_ns)s_alignof_precomputed_s; } static inline const Precomputed_U * defaultValue() NOEXCEPT { return %(c_ns)s_precomputed_base; } /** @endcond */ }; diff --git a/src/per_curve/curve_data.tmpl.h b/src/per_curve/curve_data.tmpl.h index 41da050..dc1ba49 100644 --- a/src/per_curve/curve_data.tmpl.h +++ b/src/per_curve/curve_data.tmpl.h @@ -1,6 +1,5 @@ #define API_NAME "$(c_ns)" #define API_NS(_id) $(c_ns)_##_id -#define API_NS2(_pref,_id) _pref##_$(c_ns)_##_id #define SCALAR_BITS $(C_NS)_SCALAR_BITS diff --git a/src/per_curve/decaf.tmpl.c b/src/per_curve/decaf.tmpl.c index f989c5f..14fe348 100644 --- a/src/per_curve/decaf.tmpl.c +++ b/src/per_curve/decaf.tmpl.c @@ -49,8 +49,8 @@ extern const gf API_NS(precomputed_base_as_fe)[]; const precomputed_s *API_NS(precomputed_base) = (const precomputed_s *) &API_NS(precomputed_base_as_fe); -const size_t API_NS2(sizeof,precomputed_s) = sizeof(precomputed_s); -const size_t API_NS2(alignof,precomputed_s) = sizeof(big_register_t); +const size_t API_NS(sizeof_precomputed_s) = sizeof(precomputed_s); +const size_t API_NS(alignof_precomputed_s) = sizeof(big_register_t); #define FOR_LIMB(i,op) { unsigned int i=0; for (i=0; i\n\n"); - printf("#define API_NS(_id) %s_##_id\n", API_NAME); - printf("#define API_NS2(_pref,_id) _pref##_%s_##_id\n", API_NAME); + printf("#define API_NS(_id) $(c_ns)_##_id\n"); output = (const gf_s *)real_point_base; printf("const API_NS(point_t) API_NS(point_base) = {{\n"); @@ -110,10 +112,10 @@ int main(int argc, char **argv) { output = (const gf_s *)pre; printf("const gf API_NS(precomputed_base_as_fe)[%d]\n", - (int)(API_NS2(sizeof,precomputed_s) / sizeof(gf))); - printf("__attribute__((aligned(%d),visibility(\"hidden\"))) = {\n ", (int)API_NS2(alignof,precomputed_s)); + (int)(API_NS(sizeof_precomputed_s) / sizeof(gf))); + printf("__attribute__((aligned(%d),visibility(\"hidden\"))) = {\n ", (int)API_NS(alignof_precomputed_s)); - for (i=0; i < API_NS2(sizeof,precomputed_s); i+=sizeof(gf)) { + for (i=0; i < API_NS(sizeof_precomputed_s); i+=sizeof(gf)) { if (i) printf(",\n "); field_print(output++); } @@ -121,9 +123,9 @@ int main(int argc, char **argv) { output = (const gf_s *)preWnaf; printf("const gf API_NS(precomputed_wnaf_as_fe)[%d]\n", - (int)(API_NS2(sizeof,precomputed_wnafs) / sizeof(gf))); - printf("__attribute__((aligned(%d),visibility(\"hidden\"))) = {\n ", (int)API_NS2(alignof,precomputed_s)); - for (i=0; i < API_NS2(sizeof,precomputed_wnafs); i+=sizeof(gf)) { + (int)(API_NS(sizeof_precomputed_wnafs) / sizeof(gf))); + printf("__attribute__((aligned(%d),visibility(\"hidden\"))) = {\n ", (int)API_NS(alignof_precomputed_s)); + for (i=0; i < API_NS(sizeof_precomputed_wnafs); i+=sizeof(gf)) { if (i) printf(",\n "); field_print(output++); }