Skip to content

Commit

Permalink
refac(c/math): reorder structs in point_traits.h.tpl
Browse files Browse the repository at this point in the history
This refactor reorders the structs in `point_traits.h.tpl` to match the order
in which they are used in `point_type_traits.h.tpl`.
  • Loading branch information
chokobole committed Jun 18, 2024
1 parent cb59b42 commit cc964ca
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions tachyon/c/math/elliptic_curves/generator/point_traits.h.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@

namespace tachyon::c::math {
template <>
struct PointTraits<tachyon_%{type}_%{g1_or_g2}_affine> {
using Point = tachyon::math::Point2<tachyon::math::%{type}::%{Fq_or_Fq2}>;
using CurvePoint = tachyon::math::%{type}::%{G1_or_G2}AffinePoint;
};

template <>
struct PointTraits<tachyon::math::%{type}::%{G1_or_G2}AffinePoint> {
using CPoint = tachyon_%{type}_%{g1_or_g2}_point2;
Expand All @@ -16,42 +22,29 @@ struct PointTraits<tachyon::math::%{type}::%{G1_or_G2}AffinePoint> {
};

template <>
struct PointTraits<tachyon::math::%{type}::%{G1_or_G2}ProjectivePoint> {
using CPoint = tachyon_%{type}_%{g1_or_g2}_point3;
using CCurvePoint = tachyon_%{type}_%{g1_or_g2}_projective;
using CScalarField = tachyon_%{type}_fr;
struct PointTraits<tachyon_%{type}_%{g1_or_g2}_projective> {
using Point = tachyon::math::Point3<tachyon::math::%{type}::%{Fq_or_Fq2}>;
using CurvePoint = tachyon::math::%{type}::%{G1_or_G2}ProjectivePoint;
};

template <>
struct PointTraits<tachyon::math::%{type}::%{G1_or_G2}JacobianPoint> {
struct PointTraits<tachyon::math::%{type}::%{G1_or_G2}ProjectivePoint> {
using CPoint = tachyon_%{type}_%{g1_or_g2}_point3;
using CCurvePoint = tachyon_%{type}_%{g1_or_g2}_jacobian;
using CScalarField = tachyon_%{type}_fr;
};

template <>
struct PointTraits<tachyon::math::%{type}::%{G1_or_G2}PointXYZZ> {
using CPoint = tachyon_%{type}_%{g1_or_g2}_point4;
using CCurvePoint = tachyon_%{type}_%{g1_or_g2}_xyzz;
using CCurvePoint = tachyon_%{type}_%{g1_or_g2}_projective;
using CScalarField = tachyon_%{type}_fr;
};

template <>
struct PointTraits<tachyon_%{type}_%{g1_or_g2}_affine> {
using Point = tachyon::math::Point2<tachyon::math::%{type}::%{Fq_or_Fq2}>;
using CurvePoint = tachyon::math::%{type}::%{G1_or_G2}AffinePoint;
};

template <>
struct PointTraits<tachyon_%{type}_%{g1_or_g2}_projective> {
struct PointTraits<tachyon_%{type}_%{g1_or_g2}_jacobian> {
using Point = tachyon::math::Point3<tachyon::math::%{type}::%{Fq_or_Fq2}>;
using CurvePoint = tachyon::math::%{type}::%{G1_or_G2}ProjectivePoint;
using CurvePoint = tachyon::math::%{type}::%{G1_or_G2}JacobianPoint;
};

template <>
struct PointTraits<tachyon_%{type}_%{g1_or_g2}_jacobian> {
using Point = tachyon::math::Point3<tachyon::math::%{type}::%{Fq_or_Fq2}>;
using CurvePoint = tachyon::math::%{type}::%{G1_or_G2}JacobianPoint;
struct PointTraits<tachyon::math::%{type}::%{G1_or_G2}JacobianPoint> {
using CPoint = tachyon_%{type}_%{g1_or_g2}_point3;
using CCurvePoint = tachyon_%{type}_%{g1_or_g2}_jacobian;
using CScalarField = tachyon_%{type}_fr;
};

template <>
Expand All @@ -60,6 +53,13 @@ struct PointTraits<tachyon_%{type}_%{g1_or_g2}_xyzz> {
using CurvePoint = tachyon::math::%{type}::%{G1_or_G2}PointXYZZ;
};

template <>
struct PointTraits<tachyon::math::%{type}::%{G1_or_G2}PointXYZZ> {
using CPoint = tachyon_%{type}_%{g1_or_g2}_point4;
using CCurvePoint = tachyon_%{type}_%{g1_or_g2}_xyzz;
using CScalarField = tachyon_%{type}_fr;
};

template <>
struct PointTraits<tachyon_%{type}_%{g1_or_g2}_point2> {
using Point = tachyon::math::Point2<tachyon::math::%{type}::%{Fq_or_Fq2}>;
Expand Down

0 comments on commit cc964ca

Please sign in to comment.