FK20 CUDA
fp_eq.cu
Go to the documentation of this file.
1 // bls12_381: Arithmetic for BLS12-381
2 // Copyright 2022-2023 Dag Arne Osvik
3 // Copyright 2022-2023 Luan Cardoso dos Santos
4 
5 #include "fp.cuh"
6 
14 __device__ bool fp_eq(const fp_t &x, const fp_t &y) {
15  fp_t t;
16 
17  fp_sub(t, x, y);
18 
19  return fp_iszero(t);
20 }
21 
22 // vim: ts=4 et sw=4 si
__device__ bool fp_iszero(const fp_t &x)
Checks if the residue x modulo p is congruent to zero.
Definition: fp_iszero.cu:13
uint64_t fp_t[6]
Residue modulo p. Any 384-bit representative of each residue is allowed, and stored as a 6-element li...
Definition: fp.cuh:14
__device__ void fp_sub(fp_t &z, const fp_t &x, const fp_t &y)
Calculates the difference of two residues modulo p and stores it into z.
Definition: fp_sub.cu:16
__device__ bool fp_eq(const fp_t &x, const fp_t &y)
Compares two residues modulo p.
Definition: fp_eq.cu:14