Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
proj.h
Go to the documentation of this file.
1#ifndef proj_h
2#define proj_h
3
4#include <string.h>
5
6#if defined AVX2
7 #include "../common/fp/avx2/fp-avx2.h"
8#elif defined GMP
10#elif defined KARATSUBA
12#else
13 #include "../common/fp/mulx/fp.h"
14#endif
15
16/* P^1 over fp. */
17typedef struct proj
18{
22
23static inline void proj_cswap(proj *P, proj *Q, long long c)
24{
25 fp_cswap(P->x, Q->x, c);
26 fp_cswap(P->z, Q->z, c);
27}
28
29static inline void proj_cmov(proj *P, const proj *Q, long long c)
30{
31 fp_cmov(&P->x, &Q->x, c);
32 fp_cmov(&P->z, &Q->z, c);
33}
34
35static inline void proj_copy(proj *P, const proj *Q)
36{
37 fp_copy(P->x, Q->x);
38 fp_copy(P->z, Q->z);
39}
40
41static inline int proj_equal(proj *A, proj *B)
42{
43 fp AxBz;
44 fp AzBx;
45 fp_mul3(&AxBz, (const fp*) &A->x, (const fp*) &B->z);
46 fp_mul3(&AzBx, (const fp*) &A->z, (const fp*) &B->x);
47 return !memcmp(&AxBz, &AzBx, sizeof AzBx);
48}
49
50#endif
uint64_t fp[NUMBER_OF_WORDS]
Definition fp-gmp.h:22
#define fp_cmov
Definition fp-gmp.h:323
#define fp_copy
Definition fp-gmp.h:79
#define fp_cswap
Definition fp-gmp.h:82
A
Definition tests.py:29
Definition proj.h:18
fp z
Definition proj.h:20
fp x
Definition proj.h:19