arnaucube
arnaucube/poulpyPublic Self-hosted repository
poulpy/poulpy-backend/src/cpu_spqlios/spqlios-arithmetic/spqlios/q120/q120_ntt_private.h
poulpy-backend/src/cpu_spqlios/spqlios-arithmetic/spqlios/q120/q120_ntt_private.hRaw
 1#include "q120_ntt.h"
 2
 3#ifndef NDEBUG
 4#define CHECK_BOUNDS 1
 5#define VERBOSE
 6#else
 7#define CHECK_BOUNDS 0
 8#endif
 9
10#ifndef VERBOSE
11#define LOG(...) ;
12#else
13#define LOG(...) printf(__VA_ARGS__);
14#endif
15
16typedef struct _q120_ntt_step_precomp {
17  uint64_t q2bs[4];  // q2bs = 2^{bs-31}.q[k]
18  uint64_t bs;       // inputs at this iterations must be in Q_n
19  uint64_t half_bs;  // == ceil(bs/2)
20  uint64_t mask;     // (1<<half_bs) - 1
21  uint8_t reduce;
22} q120_ntt_step_precomp;
23
24typedef struct _q120_ntt_reduc_step_precomp {
25  uint64_t modulo_red_cst[4];
26  uint64_t mask;
27  uint64_t h;
28} q120_ntt_reduc_step_precomp;
29
30typedef struct _q120_ntt_precomp {
31  uint64_t n;  // NTT size (a power of 2)
32
33  q120_ntt_step_precomp* level_metadata;
34  uint64_t* powomega;
35  q120_ntt_reduc_step_precomp reduc_metadata;
36
37  uint64_t input_bit_size;
38  uint64_t output_bit_size;
39} q120_ntt_precomp;