123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- #ifndef __BIPOINT_HPP
- #define __BIPOINT_HPP
- #include "Scalar.hpp"
- #include "curvepoint_fp.h"
- #include "twistpoint_fp2.h"
- /* It doesn't actually make sense to instantiate this generally;
- * we'll specify for each real type directly.
- * We still have to make something here, though, so it's empty. */
- template <typename T>
- class Bipoint
- {};
- template <>
- class Bipoint<curvepoint_fp_t>
- {
- public:
- Bipoint();
- Bipoint(curvepoint_fp_t p1, curvepoint_fp_t p2);
- curvepoint_fp_t& operator[](int n);
- const curvepoint_fp_t& operator[](int n) const;
- Bipoint<curvepoint_fp_t> operator+(const Bipoint<curvepoint_fp_t>& b) const;
- Bipoint<curvepoint_fp_t> operator*(const Scalar& mult) const;
- bool operator==(const Bipoint<curvepoint_fp_t>& b) const;
- bool operator!=(const Bipoint<curvepoint_fp_t>& b) const;
- // "double" is a type, so you can't just name the function that I don't think, but that's all this is
- Bipoint<curvepoint_fp_t> mult_by_2() const;
- void make_affine();
-
- private:
- curvepoint_fp_t point[2];
- };
- template <>
- class Bipoint<twistpoint_fp2_t>
- {
- public:
- Bipoint();
- Bipoint(twistpoint_fp2_t p1, twistpoint_fp2_t p2);
- twistpoint_fp2_t& operator[](int n);
- const twistpoint_fp2_t& operator[](int n) const;
- Bipoint<twistpoint_fp2_t> operator+(const Bipoint<twistpoint_fp2_t>& b) const;
- Bipoint<twistpoint_fp2_t> operator*(const Scalar& mult) const;
- bool operator==(const Bipoint<twistpoint_fp2_t>& b) const;
- bool operator!=(const Bipoint<twistpoint_fp2_t>& b) const;
- // "double" is a type, so you can't just name the function that I don't think, but that's all this is
- Bipoint<twistpoint_fp2_t> mult_by_2() const;
- void make_affine();
-
- private:
- twistpoint_fp2_t point[2];
- };
- #endif
|