FK20 CUDA
fr.cu File Reference
#include <stdio.h>
#include "fr.cuh"
Include dependency graph for fr.cu:

Go to the source code of this file.

Functions

__device__ __host__ void fr_zero (fr_t &z)
 Sets the value of z to zero. More...
 
__device__ __host__ void fr_one (fr_t &z)
 Sets the value of z to one. More...
 
__device__ void fr_print (const char *s, const fr_t &x)
 prints the canonical representation of x to STDOUT. More...
 
__device__ __host__ void fr_fromUint64 (fr_t &z, const uint64_t *x)
 Converts from uint64_t[4] to a residue modulo r, without reduction. More...
 
__device__ void fr_toUint64 (const fr_t &x, uint64_t *z)
 Converts fr_t to uint64_t[4]. More...
 
__global__ void fr_eq_wrapper (uint8_t *eq, int count, const fr_t *x, const fr_t *y)
 Checks equality of two arrays of fr_t, element wise, and store in a byte array. More...
 

Function Documentation

◆ fr_eq_wrapper()

__global__ void fr_eq_wrapper ( uint8_t *  eq,
int  count,
const fr_t x,
const fr_t y 
)

Checks equality of two arrays of fr_t, element wise, and store in a byte array.

Uses the CUDA device to perform a fast comparision between two arrays of fr_t. This function has no limitation on the number and size of blocks.

Parameters
[out]eqArray of count bytes, such that eq[i]==1 if x[i] == y[i], zero otherwise.
[in]countNumber of elements to be compared
[in]xFirst array
[in]ySecond array
Returns
void

Definition at line 99 of file fr.cu.

Here is the call graph for this function:

◆ fr_fromUint64()

__device__ __host__ void fr_fromUint64 ( fr_t z,
const uint64_t *  x 
)

Converts from uint64_t[4] to a residue modulo r, without reduction.

Parameters
[out]zResidue modulo r
[in]xArray of uint64_t
Returns
void

Definition at line 59 of file fr.cu.

◆ fr_one()

__device__ __host__ void fr_one ( fr_t z)

Sets the value of z to one.

Parameters
[out]z
Returns
void

Definition at line 26 of file fr.cu.

Here is the caller graph for this function:

◆ fr_print()

__device__ void fr_print ( const char *  s,
const fr_t x 
)

prints the canonical representation of x to STDOUT.

Prints the canonical hexadecimal representation of x to stdout, followed by linefeed; prints with leading zeros, and without the hex prefix.

Parameters
[in]sDescription string
[in]x
Returns
void

Definition at line 41 of file fr.cu.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fr_toUint64()

__device__ void fr_toUint64 ( const fr_t x,
uint64_t *  z 
)

Converts fr_t to uint64_t[4].

Converts uint64_t[4] to fr_t. The 256-bit value in x is reduced to the canonical residue before being stored into z. The original value of x is unchanged.

Parameters
[out]zPointer to destination array.
[in]xfr_t to be converted.
Returns
void

Definition at line 76 of file fr.cu.

Here is the call graph for this function:

◆ fr_zero()

__device__ __host__ void fr_zero ( fr_t z)

Sets the value of z to zero.

Parameters
[out]z
Returns
void

Definition at line 15 of file fr.cu.

Here is the caller graph for this function: