From 7fb5b0e9a47dcff6bd222664f19f67d3f6063b7d Mon Sep 17 00:00:00 2001 From: "John M. Schanck" Date: Mon, 14 Sep 2020 17:02:28 -0400 Subject: [PATCH] Revert "ms compiler changes for fft.c" This reverts commit 99bed07f6476d0243b3981051c087ad5249c5c43. --- crypto_kem/hqc-128/avx2/fft.c | 15 ++++++++------- crypto_kem/hqc-128/clean/fft.c | 28 +++++++++++++++------------- crypto_kem/hqc-192/avx2/fft.c | 15 ++++++++------- crypto_kem/hqc-192/clean/fft.c | 28 +++++++++++++++------------- crypto_kem/hqc-256/avx2/fft.c | 15 ++++++++------- crypto_kem/hqc-256/clean/fft.c | 28 +++++++++++++++------------- crypto_kem/hqc-rmrs-128/avx2/fft.c | 12 ++++++------ crypto_kem/hqc-rmrs-128/clean/fft.c | 12 ++++++------ crypto_kem/hqc-rmrs-192/avx2/fft.c | 12 ++++++------ crypto_kem/hqc-rmrs-192/clean/fft.c | 12 ++++++------ crypto_kem/hqc-rmrs-256/avx2/fft.c | 12 ++++++------ crypto_kem/hqc-rmrs-256/clean/fft.c | 12 ++++++------ 12 files changed, 105 insertions(+), 96 deletions(-) diff --git a/crypto_kem/hqc-128/avx2/fft.c b/crypto_kem/hqc-128/avx2/fft.c index 1e15f0fb..476a621f 100644 --- a/crypto_kem/hqc-128/avx2/fft.c +++ b/crypto_kem/hqc-128/avx2/fft.c @@ -31,7 +31,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32 static void compute_fft_betas(uint16_t *betas) { size_t i; for (i = 0; i < PARAM_M - 1; ++i) { - betas[i] = (uint16_t) (1 << (PARAM_M - 1 - i)); + betas[i] = 1 << (PARAM_M - 1 - i); } } @@ -134,7 +134,7 @@ static void radix_big(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_ size_t i, n; - n = (size_t) (1 << (m_f - 2)); + n = 1 << (m_f - 2); memcpy(Q, f + 3 * n, 2 * n); memcpy(Q + n, f + 3 * n, 2 * n); memcpy(R, f, 4 * n); @@ -202,7 +202,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32 // Step 2: compute g if (betas[m - 1] != 1) { beta_m_pow = 1; - x = (size_t) (1 << m_f); + x = 1 << m_f; for (i = 1; i < x; ++i) { beta_m_pow = PQCLEAN_HQC128_AVX2_gf_mul(beta_m_pow, betas[m - 1]); f[i] = PQCLEAN_HQC128_AVX2_gf_mul(beta_m_pow, f[i]); @@ -224,7 +224,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32 // Step 5 fft_rec(u, f0, (f_coeffs + 1) / 2, m - 1, m_f - 1, deltas); - k = (size_t) (1 << ((m - 1) & 0xf)); // &0xf is to let the compiler know that m-1 is small. + k = 1 << ((m - 1) & 0xf); // &0xf is to let the compiler know that m-1 is small. if (f_coeffs <= 3) { // 3-coefficient polynomial f case: f1 is constant w[0] = u[0]; w[k] = u[0] ^ f1[0]; @@ -300,7 +300,7 @@ void PQCLEAN_HQC128_AVX2_fft(uint16_t *w, const uint16_t *f, size_t f_coeffs) { fft_rec(u, f0, (f_coeffs + 1) / 2, PARAM_M - 1, PARAM_FFT - 1, deltas); fft_rec(v, f1, f_coeffs / 2, PARAM_M - 1, PARAM_FFT - 1, deltas); - k = (size_t) (1 << (PARAM_M - 1)); + k = 1 << (PARAM_M - 1); // Step 6, 7 and error polynomial computation memcpy(w + k, v, 2 * k); @@ -329,14 +329,15 @@ void PQCLEAN_HQC128_AVX2_fft_retrieve_bch_error_poly(uint64_t *error, const uint uint16_t gammas[PARAM_M - 1] = {0}; uint16_t gammas_sums[1 << (PARAM_M - 1)] = {0}; uint64_t bit; - size_t i, k, index; + uint16_t k; + size_t i, index; compute_fft_betas(gammas); compute_subset_sums(gammas_sums, gammas, PARAM_M - 1); error[0] ^= 1 ^ ((uint16_t) - w[0] >> 15); - k = (size_t) (1 << (PARAM_M - 1)); + k = 1 << (PARAM_M - 1); index = PARAM_GF_MUL_ORDER; bit = 1 ^ ((uint16_t) - w[k] >> 15); error[index / 8] ^= bit << (index % 64); diff --git a/crypto_kem/hqc-128/clean/fft.c b/crypto_kem/hqc-128/clean/fft.c index c22e22ef..64901bec 100644 --- a/crypto_kem/hqc-128/clean/fft.c +++ b/crypto_kem/hqc-128/clean/fft.c @@ -34,7 +34,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32 static void compute_fft_betas(uint16_t *betas) { size_t i; for (i = 0; i < PARAM_M - 1; ++i) { - betas[i] = (uint16_t) (1 << (PARAM_M - 1 - i)); + betas[i] = 1 << (PARAM_M - 1 - i); } } @@ -134,9 +134,10 @@ static void radix_t_big(uint16_t *f, const uint16_t *f0, const uint16_t *f1, uin uint16_t Q[1 << 2 * (PARAM_FFT_T - 2)] = {0}; uint16_t R[1 << 2 * (PARAM_FFT_T - 2)] = {0}; - size_t i, n; + uint16_t n; + size_t i; - n = (size_t) (1 << (m_f - 2)); + n = 1 << (m_f - 2); memcpy(Q0, f0 + n, 2 * n); memcpy(Q1, f1 + n, 2 * n); memcpy(R0, f0, 2 * n); @@ -186,7 +187,7 @@ static void fft_t_rec(uint16_t *f, const uint16_t *w, size_t f_coeffs, uint8_t m // Step 1 if (m_f == 1) { f[0] = 0; - x = (size_t) (1 << m); + x = 1 << m; for (i = 0; i < x; ++i) { f[0] ^= w[i]; } @@ -220,7 +221,7 @@ static void fft_t_rec(uint16_t *f, const uint16_t *w, size_t f_coeffs, uint8_t m * Transpose: * u[i] = w[i] + w[k+i] * v[i] = G[i].w[i] + (G[i]+1).w[k+i] = G[i].u[i] + w[k+i] */ - k = (size_t) (1 << ((m - 1) & 0xf)); // &0xf is to let the compiler know that m-1 is small. + k = 1 << ((m - 1) & 0xf); // &0xf is to let the compiler know that m-1 is small. if (f_coeffs <= 3) { // 3-coefficient polynomial f case // Step 5: Compute f0 from u and f1 from v f1[1] = 0; @@ -251,7 +252,7 @@ static void fft_t_rec(uint16_t *f, const uint16_t *w, size_t f_coeffs, uint8_t m // Step 2: compute f from g if (betas[m - 1] != 1) { beta_m_pow = 1; - x = (size_t) (1 << m_f); + x = 1 << m_f; for (i = 1; i < x; ++i) { beta_m_pow = PQCLEAN_HQC128_CLEAN_gf_mul(beta_m_pow, betas[m - 1]); f[i] = PQCLEAN_HQC128_CLEAN_gf_mul(beta_m_pow, f[i]); @@ -296,7 +297,7 @@ void PQCLEAN_HQC128_CLEAN_fft_t(uint16_t *f, const uint16_t *w, size_t f_coeffs) * Transpose: * u[i] = w[i] + w[k+i] * v[i] = G[i].w[i] + (G[i]+1).w[k+i] = G[i].u[i] + w[k+i] */ - k = (size_t) (1 << (PARAM_M - 1)); + k = 1 << (PARAM_M - 1); u[0] = w[0] ^ w[k]; v[0] = w[k]; for (i = 1; i < k; ++i) { @@ -395,7 +396,7 @@ static void radix_big(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_ size_t i, n; - n = (size_t) (1 << (m_f - 2)); + n = 1 << (m_f - 2); memcpy(Q, f + 3 * n, 2 * n); memcpy(Q + n, f + 3 * n, 2 * n); memcpy(R, f, 4 * n); @@ -463,7 +464,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32 // Step 2: compute g if (betas[m - 1] != 1) { beta_m_pow = 1; - x = (size_t) (1 << m_f); + x = 1 << m_f; for (i = 1; i < x; ++i) { beta_m_pow = PQCLEAN_HQC128_CLEAN_gf_mul(beta_m_pow, betas[m - 1]); f[i] = PQCLEAN_HQC128_CLEAN_gf_mul(beta_m_pow, f[i]); @@ -485,7 +486,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32 // Step 5 fft_rec(u, f0, (f_coeffs + 1) / 2, m - 1, m_f - 1, deltas); - k = (size_t) (1 << ((m - 1) & 0xf)); // &0xf is to let the compiler know that m-1 is small. + k = 1 << ((m - 1) & 0xf); // &0xf is to let the compiler know that m-1 is small. if (f_coeffs <= 3) { // 3-coefficient polynomial f case: f1 is constant w[0] = u[0]; w[k] = u[0] ^ f1[0]; @@ -561,7 +562,7 @@ void PQCLEAN_HQC128_CLEAN_fft(uint16_t *w, const uint16_t *f, size_t f_coeffs) { fft_rec(u, f0, (f_coeffs + 1) / 2, PARAM_M - 1, PARAM_FFT - 1, deltas); fft_rec(v, f1, f_coeffs / 2, PARAM_M - 1, PARAM_FFT - 1, deltas); - k = (size_t) (1 << (PARAM_M - 1)); + k = 1 << (PARAM_M - 1); // Step 6, 7 and error polynomial computation memcpy(w + k, v, 2 * k); @@ -636,14 +637,15 @@ void PQCLEAN_HQC128_CLEAN_fft_retrieve_bch_error_poly(uint64_t *error, const uin uint16_t gammas[PARAM_M - 1] = {0}; uint16_t gammas_sums[1 << (PARAM_M - 1)] = {0}; uint64_t bit; - size_t i, k, index; + uint16_t k; + size_t i, index; compute_fft_betas(gammas); compute_subset_sums(gammas_sums, gammas, PARAM_M - 1); error[0] ^= 1 ^ ((uint16_t) - w[0] >> 15); - k = (size_t) (1 << (PARAM_M - 1)); + k = 1 << (PARAM_M - 1); index = PARAM_GF_MUL_ORDER; bit = 1 ^ ((uint16_t) - w[k] >> 15); error[index / 8] ^= bit << (index % 64); diff --git a/crypto_kem/hqc-192/avx2/fft.c b/crypto_kem/hqc-192/avx2/fft.c index ea085f5e..8b851ce9 100644 --- a/crypto_kem/hqc-192/avx2/fft.c +++ b/crypto_kem/hqc-192/avx2/fft.c @@ -31,7 +31,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32 static void compute_fft_betas(uint16_t *betas) { size_t i; for (i = 0; i < PARAM_M - 1; ++i) { - betas[i] = (uint16_t) (1 << (PARAM_M - 1 - i)); + betas[i] = 1 << (PARAM_M - 1 - i); } } @@ -134,7 +134,7 @@ static void radix_big(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_ size_t i, n; - n = (size_t) (1 << (m_f - 2)); + n = 1 << (m_f - 2); memcpy(Q, f + 3 * n, 2 * n); memcpy(Q + n, f + 3 * n, 2 * n); memcpy(R, f, 4 * n); @@ -202,7 +202,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32 // Step 2: compute g if (betas[m - 1] != 1) { beta_m_pow = 1; - x = (size_t) (1 << m_f); + x = 1 << m_f; for (i = 1; i < x; ++i) { beta_m_pow = PQCLEAN_HQC192_AVX2_gf_mul(beta_m_pow, betas[m - 1]); f[i] = PQCLEAN_HQC192_AVX2_gf_mul(beta_m_pow, f[i]); @@ -224,7 +224,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32 // Step 5 fft_rec(u, f0, (f_coeffs + 1) / 2, m - 1, m_f - 1, deltas); - k = (size_t) (1 << ((m - 1) & 0xf)); // &0xf is to let the compiler know that m-1 is small. + k = 1 << ((m - 1) & 0xf); // &0xf is to let the compiler know that m-1 is small. if (f_coeffs <= 3) { // 3-coefficient polynomial f case: f1 is constant w[0] = u[0]; w[k] = u[0] ^ f1[0]; @@ -300,7 +300,7 @@ void PQCLEAN_HQC192_AVX2_fft(uint16_t *w, const uint16_t *f, size_t f_coeffs) { fft_rec(u, f0, (f_coeffs + 1) / 2, PARAM_M - 1, PARAM_FFT - 1, deltas); fft_rec(v, f1, f_coeffs / 2, PARAM_M - 1, PARAM_FFT - 1, deltas); - k = (size_t) (1 << (PARAM_M - 1)); + k = 1 << (PARAM_M - 1); // Step 6, 7 and error polynomial computation memcpy(w + k, v, 2 * k); @@ -329,14 +329,15 @@ void PQCLEAN_HQC192_AVX2_fft_retrieve_bch_error_poly(uint64_t *error, const uint uint16_t gammas[PARAM_M - 1] = {0}; uint16_t gammas_sums[1 << (PARAM_M - 1)] = {0}; uint64_t bit; - size_t i, k, index; + uint16_t k; + size_t i, index; compute_fft_betas(gammas); compute_subset_sums(gammas_sums, gammas, PARAM_M - 1); error[0] ^= 1 ^ ((uint16_t) - w[0] >> 15); - k = (size_t) (1 << (PARAM_M - 1)); + k = 1 << (PARAM_M - 1); index = PARAM_GF_MUL_ORDER; bit = 1 ^ ((uint16_t) - w[k] >> 15); error[index / 8] ^= bit << (index % 64); diff --git a/crypto_kem/hqc-192/clean/fft.c b/crypto_kem/hqc-192/clean/fft.c index 801d121b..64226507 100644 --- a/crypto_kem/hqc-192/clean/fft.c +++ b/crypto_kem/hqc-192/clean/fft.c @@ -34,7 +34,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32 static void compute_fft_betas(uint16_t *betas) { size_t i; for (i = 0; i < PARAM_M - 1; ++i) { - betas[i] = (uint16_t) (1 << (PARAM_M - 1 - i)); + betas[i] = 1 << (PARAM_M - 1 - i); } } @@ -134,9 +134,10 @@ static void radix_t_big(uint16_t *f, const uint16_t *f0, const uint16_t *f1, uin uint16_t Q[1 << 2 * (PARAM_FFT_T - 2)] = {0}; uint16_t R[1 << 2 * (PARAM_FFT_T - 2)] = {0}; - size_t i, n; + uint16_t n; + size_t i; - n = (size_t) (1 << (m_f - 2)); + n = 1 << (m_f - 2); memcpy(Q0, f0 + n, 2 * n); memcpy(Q1, f1 + n, 2 * n); memcpy(R0, f0, 2 * n); @@ -186,7 +187,7 @@ static void fft_t_rec(uint16_t *f, const uint16_t *w, size_t f_coeffs, uint8_t m // Step 1 if (m_f == 1) { f[0] = 0; - x = (size_t) (1 << m); + x = 1 << m; for (i = 0; i < x; ++i) { f[0] ^= w[i]; } @@ -220,7 +221,7 @@ static void fft_t_rec(uint16_t *f, const uint16_t *w, size_t f_coeffs, uint8_t m * Transpose: * u[i] = w[i] + w[k+i] * v[i] = G[i].w[i] + (G[i]+1).w[k+i] = G[i].u[i] + w[k+i] */ - k = (size_t) (1 << ((m - 1) & 0xf)); // &0xf is to let the compiler know that m-1 is small. + k = 1 << ((m - 1) & 0xf); // &0xf is to let the compiler know that m-1 is small. if (f_coeffs <= 3) { // 3-coefficient polynomial f case // Step 5: Compute f0 from u and f1 from v f1[1] = 0; @@ -251,7 +252,7 @@ static void fft_t_rec(uint16_t *f, const uint16_t *w, size_t f_coeffs, uint8_t m // Step 2: compute f from g if (betas[m - 1] != 1) { beta_m_pow = 1; - x = (size_t) (1 << m_f); + x = 1 << m_f; for (i = 1; i < x; ++i) { beta_m_pow = PQCLEAN_HQC192_CLEAN_gf_mul(beta_m_pow, betas[m - 1]); f[i] = PQCLEAN_HQC192_CLEAN_gf_mul(beta_m_pow, f[i]); @@ -296,7 +297,7 @@ void PQCLEAN_HQC192_CLEAN_fft_t(uint16_t *f, const uint16_t *w, size_t f_coeffs) * Transpose: * u[i] = w[i] + w[k+i] * v[i] = G[i].w[i] + (G[i]+1).w[k+i] = G[i].u[i] + w[k+i] */ - k = (size_t) (1 << (PARAM_M - 1)); + k = 1 << (PARAM_M - 1); u[0] = w[0] ^ w[k]; v[0] = w[k]; for (i = 1; i < k; ++i) { @@ -395,7 +396,7 @@ static void radix_big(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_ size_t i, n; - n = (size_t) (1 << (m_f - 2)); + n = 1 << (m_f - 2); memcpy(Q, f + 3 * n, 2 * n); memcpy(Q + n, f + 3 * n, 2 * n); memcpy(R, f, 4 * n); @@ -463,7 +464,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32 // Step 2: compute g if (betas[m - 1] != 1) { beta_m_pow = 1; - x = (size_t) (1 << m_f); + x = 1 << m_f; for (i = 1; i < x; ++i) { beta_m_pow = PQCLEAN_HQC192_CLEAN_gf_mul(beta_m_pow, betas[m - 1]); f[i] = PQCLEAN_HQC192_CLEAN_gf_mul(beta_m_pow, f[i]); @@ -485,7 +486,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32 // Step 5 fft_rec(u, f0, (f_coeffs + 1) / 2, m - 1, m_f - 1, deltas); - k = (size_t) (1 << ((m - 1) & 0xf)); // &0xf is to let the compiler know that m-1 is small. + k = 1 << ((m - 1) & 0xf); // &0xf is to let the compiler know that m-1 is small. if (f_coeffs <= 3) { // 3-coefficient polynomial f case: f1 is constant w[0] = u[0]; w[k] = u[0] ^ f1[0]; @@ -561,7 +562,7 @@ void PQCLEAN_HQC192_CLEAN_fft(uint16_t *w, const uint16_t *f, size_t f_coeffs) { fft_rec(u, f0, (f_coeffs + 1) / 2, PARAM_M - 1, PARAM_FFT - 1, deltas); fft_rec(v, f1, f_coeffs / 2, PARAM_M - 1, PARAM_FFT - 1, deltas); - k = (size_t) (1 << (PARAM_M - 1)); + k = 1 << (PARAM_M - 1); // Step 6, 7 and error polynomial computation memcpy(w + k, v, 2 * k); @@ -636,14 +637,15 @@ void PQCLEAN_HQC192_CLEAN_fft_retrieve_bch_error_poly(uint64_t *error, const uin uint16_t gammas[PARAM_M - 1] = {0}; uint16_t gammas_sums[1 << (PARAM_M - 1)] = {0}; uint64_t bit; - size_t i, k, index; + uint16_t k; + size_t i, index; compute_fft_betas(gammas); compute_subset_sums(gammas_sums, gammas, PARAM_M - 1); error[0] ^= 1 ^ ((uint16_t) - w[0] >> 15); - k = (size_t) (1 << (PARAM_M - 1)); + k = 1 << (PARAM_M - 1); index = PARAM_GF_MUL_ORDER; bit = 1 ^ ((uint16_t) - w[k] >> 15); error[index / 8] ^= bit << (index % 64); diff --git a/crypto_kem/hqc-256/avx2/fft.c b/crypto_kem/hqc-256/avx2/fft.c index 0d73586c..dc73de0f 100644 --- a/crypto_kem/hqc-256/avx2/fft.c +++ b/crypto_kem/hqc-256/avx2/fft.c @@ -31,7 +31,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32 static void compute_fft_betas(uint16_t *betas) { size_t i; for (i = 0; i < PARAM_M - 1; ++i) { - betas[i] = (uint16_t) (1 << (PARAM_M - 1 - i)); + betas[i] = 1 << (PARAM_M - 1 - i); } } @@ -134,7 +134,7 @@ static void radix_big(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_ size_t i, n; - n = (size_t) (1 << (m_f - 2)); + n = 1 << (m_f - 2); memcpy(Q, f + 3 * n, 2 * n); memcpy(Q + n, f + 3 * n, 2 * n); memcpy(R, f, 4 * n); @@ -202,7 +202,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32 // Step 2: compute g if (betas[m - 1] != 1) { beta_m_pow = 1; - x = (size_t) (1 << m_f); + x = 1 << m_f; for (i = 1; i < x; ++i) { beta_m_pow = PQCLEAN_HQC256_AVX2_gf_mul(beta_m_pow, betas[m - 1]); f[i] = PQCLEAN_HQC256_AVX2_gf_mul(beta_m_pow, f[i]); @@ -224,7 +224,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32 // Step 5 fft_rec(u, f0, (f_coeffs + 1) / 2, m - 1, m_f - 1, deltas); - k = (size_t) (1 << ((m - 1) & 0xf)); // &0xf is to let the compiler know that m-1 is small. + k = 1 << ((m - 1) & 0xf); // &0xf is to let the compiler know that m-1 is small. if (f_coeffs <= 3) { // 3-coefficient polynomial f case: f1 is constant w[0] = u[0]; w[k] = u[0] ^ f1[0]; @@ -300,7 +300,7 @@ void PQCLEAN_HQC256_AVX2_fft(uint16_t *w, const uint16_t *f, size_t f_coeffs) { fft_rec(u, f0, (f_coeffs + 1) / 2, PARAM_M - 1, PARAM_FFT - 1, deltas); fft_rec(v, f1, f_coeffs / 2, PARAM_M - 1, PARAM_FFT - 1, deltas); - k = (size_t) (1 << (PARAM_M - 1)); + k = 1 << (PARAM_M - 1); // Step 6, 7 and error polynomial computation memcpy(w + k, v, 2 * k); @@ -329,14 +329,15 @@ void PQCLEAN_HQC256_AVX2_fft_retrieve_bch_error_poly(uint64_t *error, const uint uint16_t gammas[PARAM_M - 1] = {0}; uint16_t gammas_sums[1 << (PARAM_M - 1)] = {0}; uint64_t bit; - size_t i, k, index; + uint16_t k; + size_t i, index; compute_fft_betas(gammas); compute_subset_sums(gammas_sums, gammas, PARAM_M - 1); error[0] ^= 1 ^ ((uint16_t) - w[0] >> 15); - k = (size_t) (1 << (PARAM_M - 1)); + k = 1 << (PARAM_M - 1); index = PARAM_GF_MUL_ORDER; bit = 1 ^ ((uint16_t) - w[k] >> 15); error[index / 8] ^= bit << (index % 64); diff --git a/crypto_kem/hqc-256/clean/fft.c b/crypto_kem/hqc-256/clean/fft.c index bf8aaa0a..147f4193 100644 --- a/crypto_kem/hqc-256/clean/fft.c +++ b/crypto_kem/hqc-256/clean/fft.c @@ -34,7 +34,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32 static void compute_fft_betas(uint16_t *betas) { size_t i; for (i = 0; i < PARAM_M - 1; ++i) { - betas[i] = (uint16_t) (1 << (PARAM_M - 1 - i)); + betas[i] = 1 << (PARAM_M - 1 - i); } } @@ -134,9 +134,10 @@ static void radix_t_big(uint16_t *f, const uint16_t *f0, const uint16_t *f1, uin uint16_t Q[1 << 2 * (PARAM_FFT_T - 2)] = {0}; uint16_t R[1 << 2 * (PARAM_FFT_T - 2)] = {0}; - size_t i, n; + uint16_t n; + size_t i; - n = (size_t) (1 << (m_f - 2)); + n = 1 << (m_f - 2); memcpy(Q0, f0 + n, 2 * n); memcpy(Q1, f1 + n, 2 * n); memcpy(R0, f0, 2 * n); @@ -186,7 +187,7 @@ static void fft_t_rec(uint16_t *f, const uint16_t *w, size_t f_coeffs, uint8_t m // Step 1 if (m_f == 1) { f[0] = 0; - x = (size_t) (1 << m); + x = 1 << m; for (i = 0; i < x; ++i) { f[0] ^= w[i]; } @@ -220,7 +221,7 @@ static void fft_t_rec(uint16_t *f, const uint16_t *w, size_t f_coeffs, uint8_t m * Transpose: * u[i] = w[i] + w[k+i] * v[i] = G[i].w[i] + (G[i]+1).w[k+i] = G[i].u[i] + w[k+i] */ - k = (size_t) (1 << ((m - 1) & 0xf)); // &0xf is to let the compiler know that m-1 is small. + k = 1 << ((m - 1) & 0xf); // &0xf is to let the compiler know that m-1 is small. if (f_coeffs <= 3) { // 3-coefficient polynomial f case // Step 5: Compute f0 from u and f1 from v f1[1] = 0; @@ -251,7 +252,7 @@ static void fft_t_rec(uint16_t *f, const uint16_t *w, size_t f_coeffs, uint8_t m // Step 2: compute f from g if (betas[m - 1] != 1) { beta_m_pow = 1; - x = (size_t) (1 << m_f); + x = 1 << m_f; for (i = 1; i < x; ++i) { beta_m_pow = PQCLEAN_HQC256_CLEAN_gf_mul(beta_m_pow, betas[m - 1]); f[i] = PQCLEAN_HQC256_CLEAN_gf_mul(beta_m_pow, f[i]); @@ -296,7 +297,7 @@ void PQCLEAN_HQC256_CLEAN_fft_t(uint16_t *f, const uint16_t *w, size_t f_coeffs) * Transpose: * u[i] = w[i] + w[k+i] * v[i] = G[i].w[i] + (G[i]+1).w[k+i] = G[i].u[i] + w[k+i] */ - k = (size_t) (1 << (PARAM_M - 1)); + k = 1 << (PARAM_M - 1); u[0] = w[0] ^ w[k]; v[0] = w[k]; for (i = 1; i < k; ++i) { @@ -395,7 +396,7 @@ static void radix_big(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_ size_t i, n; - n = (size_t) (1 << (m_f - 2)); + n = 1 << (m_f - 2); memcpy(Q, f + 3 * n, 2 * n); memcpy(Q + n, f + 3 * n, 2 * n); memcpy(R, f, 4 * n); @@ -463,7 +464,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32 // Step 2: compute g if (betas[m - 1] != 1) { beta_m_pow = 1; - x = (size_t) (1 << m_f); + x = 1 << m_f; for (i = 1; i < x; ++i) { beta_m_pow = PQCLEAN_HQC256_CLEAN_gf_mul(beta_m_pow, betas[m - 1]); f[i] = PQCLEAN_HQC256_CLEAN_gf_mul(beta_m_pow, f[i]); @@ -485,7 +486,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32 // Step 5 fft_rec(u, f0, (f_coeffs + 1) / 2, m - 1, m_f - 1, deltas); - k = (size_t) (1 << ((m - 1) & 0xf)); // &0xf is to let the compiler know that m-1 is small. + k = 1 << ((m - 1) & 0xf); // &0xf is to let the compiler know that m-1 is small. if (f_coeffs <= 3) { // 3-coefficient polynomial f case: f1 is constant w[0] = u[0]; w[k] = u[0] ^ f1[0]; @@ -561,7 +562,7 @@ void PQCLEAN_HQC256_CLEAN_fft(uint16_t *w, const uint16_t *f, size_t f_coeffs) { fft_rec(u, f0, (f_coeffs + 1) / 2, PARAM_M - 1, PARAM_FFT - 1, deltas); fft_rec(v, f1, f_coeffs / 2, PARAM_M - 1, PARAM_FFT - 1, deltas); - k = (size_t) (1 << (PARAM_M - 1)); + k = 1 << (PARAM_M - 1); // Step 6, 7 and error polynomial computation memcpy(w + k, v, 2 * k); @@ -636,14 +637,15 @@ void PQCLEAN_HQC256_CLEAN_fft_retrieve_bch_error_poly(uint64_t *error, const uin uint16_t gammas[PARAM_M - 1] = {0}; uint16_t gammas_sums[1 << (PARAM_M - 1)] = {0}; uint64_t bit; - size_t i, k, index; + uint16_t k; + size_t i, index; compute_fft_betas(gammas); compute_subset_sums(gammas_sums, gammas, PARAM_M - 1); error[0] ^= 1 ^ ((uint16_t) - w[0] >> 15); - k = (size_t) (1 << (PARAM_M - 1)); + k = 1 << (PARAM_M - 1); index = PARAM_GF_MUL_ORDER; bit = 1 ^ ((uint16_t) - w[k] >> 15); error[index / 8] ^= bit << (index % 64); diff --git a/crypto_kem/hqc-rmrs-128/avx2/fft.c b/crypto_kem/hqc-rmrs-128/avx2/fft.c index 72e53000..e5ab65cc 100644 --- a/crypto_kem/hqc-rmrs-128/avx2/fft.c +++ b/crypto_kem/hqc-rmrs-128/avx2/fft.c @@ -30,7 +30,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32 static void compute_fft_betas(uint16_t *betas) { size_t i; for (i = 0; i < PARAM_M - 1; ++i) { - betas[i] = (uint16_t) (1 << (PARAM_M - 1 - i)); + betas[i] = 1 << (PARAM_M - 1 - i); } } @@ -133,7 +133,7 @@ static void radix_big(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_ size_t i, n; - n = (size_t) (1 << (m_f - 2)); + n = 1 << (m_f - 2); memcpy(Q, f + 3 * n, 2 * n); memcpy(Q + n, f + 3 * n, 2 * n); memcpy(R, f, 4 * n); @@ -201,7 +201,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32 // Step 2: compute g if (betas[m - 1] != 1) { beta_m_pow = 1; - x = (size_t) (1 << m_f); + x = 1 << m_f; for (i = 1; i < x; ++i) { beta_m_pow = PQCLEAN_HQCRMRS128_AVX2_gf_mul(beta_m_pow, betas[m - 1]); f[i] = PQCLEAN_HQCRMRS128_AVX2_gf_mul(beta_m_pow, f[i]); @@ -223,7 +223,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32 // Step 5 fft_rec(u, f0, (f_coeffs + 1) / 2, m - 1, m_f - 1, deltas); - k = (size_t) (1 << ((m - 1) & 0xf)); // &0xf is to let the compiler know that m-1 is small. + k = 1 << ((m - 1) & 0xf); // &0xf is to let the compiler know that m-1 is small. if (f_coeffs <= 3) { // 3-coefficient polynomial f case: f1 is constant w[0] = u[0]; w[k] = u[0] ^ f1[0]; @@ -299,7 +299,7 @@ void PQCLEAN_HQCRMRS128_AVX2_fft(uint16_t *w, const uint16_t *f, size_t f_coeffs fft_rec(u, f0, (f_coeffs + 1) / 2, PARAM_M - 1, PARAM_FFT - 1, deltas); fft_rec(v, f1, f_coeffs / 2, PARAM_M - 1, PARAM_FFT - 1, deltas); - k = (size_t) (1 << (PARAM_M - 1)); + k = 1 << (PARAM_M - 1); // Step 6, 7 and error polynomial computation memcpy(w + k, v, 2 * k); @@ -334,7 +334,7 @@ void PQCLEAN_HQCRMRS128_AVX2_fft_retrieve_error_poly(uint8_t *error, const uint1 compute_fft_betas(gammas); compute_subset_sums(gammas_sums, gammas, PARAM_M - 1); - k = (size_t) (1 << (PARAM_M - 1)); + k = 1 << (PARAM_M - 1); error[0] ^= 1 ^ ((uint16_t) - w[0] >> 15); error[0] ^= 1 ^ ((uint16_t) - w[k] >> 15); diff --git a/crypto_kem/hqc-rmrs-128/clean/fft.c b/crypto_kem/hqc-rmrs-128/clean/fft.c index b5ea0243..f89cafae 100644 --- a/crypto_kem/hqc-rmrs-128/clean/fft.c +++ b/crypto_kem/hqc-rmrs-128/clean/fft.c @@ -30,7 +30,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32 static void compute_fft_betas(uint16_t *betas) { size_t i; for (i = 0; i < PARAM_M - 1; ++i) { - betas[i] = (uint16_t) (1 << (PARAM_M - 1 - i)); + betas[i] = 1 << (PARAM_M - 1 - i); } } @@ -133,7 +133,7 @@ static void radix_big(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_ size_t i, n; - n = (size_t) (1 << (m_f - 2)); + n = 1 << (m_f - 2); memcpy(Q, f + 3 * n, 2 * n); memcpy(Q + n, f + 3 * n, 2 * n); memcpy(R, f, 4 * n); @@ -201,7 +201,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32 // Step 2: compute g if (betas[m - 1] != 1) { beta_m_pow = 1; - x = (size_t) (1 << m_f); + x = 1 << m_f; for (i = 1; i < x; ++i) { beta_m_pow = PQCLEAN_HQCRMRS128_CLEAN_gf_mul(beta_m_pow, betas[m - 1]); f[i] = PQCLEAN_HQCRMRS128_CLEAN_gf_mul(beta_m_pow, f[i]); @@ -223,7 +223,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32 // Step 5 fft_rec(u, f0, (f_coeffs + 1) / 2, m - 1, m_f - 1, deltas); - k = (size_t) (1 << ((m - 1) & 0xf)); // &0xf is to let the compiler know that m-1 is small. + k = 1 << ((m - 1) & 0xf); // &0xf is to let the compiler know that m-1 is small. if (f_coeffs <= 3) { // 3-coefficient polynomial f case: f1 is constant w[0] = u[0]; w[k] = u[0] ^ f1[0]; @@ -299,7 +299,7 @@ void PQCLEAN_HQCRMRS128_CLEAN_fft(uint16_t *w, const uint16_t *f, size_t f_coeff fft_rec(u, f0, (f_coeffs + 1) / 2, PARAM_M - 1, PARAM_FFT - 1, deltas); fft_rec(v, f1, f_coeffs / 2, PARAM_M - 1, PARAM_FFT - 1, deltas); - k = (size_t) (1 << (PARAM_M - 1)); + k = 1 << (PARAM_M - 1); // Step 6, 7 and error polynomial computation memcpy(w + k, v, 2 * k); @@ -334,7 +334,7 @@ void PQCLEAN_HQCRMRS128_CLEAN_fft_retrieve_error_poly(uint8_t *error, const uint compute_fft_betas(gammas); compute_subset_sums(gammas_sums, gammas, PARAM_M - 1); - k = (size_t) (1 << (PARAM_M - 1)); + k = 1 << (PARAM_M - 1); error[0] ^= 1 ^ ((uint16_t) - w[0] >> 15); error[0] ^= 1 ^ ((uint16_t) - w[k] >> 15); diff --git a/crypto_kem/hqc-rmrs-192/avx2/fft.c b/crypto_kem/hqc-rmrs-192/avx2/fft.c index b1eb64b1..382043e2 100644 --- a/crypto_kem/hqc-rmrs-192/avx2/fft.c +++ b/crypto_kem/hqc-rmrs-192/avx2/fft.c @@ -30,7 +30,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32 static void compute_fft_betas(uint16_t *betas) { size_t i; for (i = 0; i < PARAM_M - 1; ++i) { - betas[i] = (uint16_t) (1 << (PARAM_M - 1 - i)); + betas[i] = 1 << (PARAM_M - 1 - i); } } @@ -133,7 +133,7 @@ static void radix_big(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_ size_t i, n; - n = (size_t) (1 << (m_f - 2)); + n = 1 << (m_f - 2); memcpy(Q, f + 3 * n, 2 * n); memcpy(Q + n, f + 3 * n, 2 * n); memcpy(R, f, 4 * n); @@ -201,7 +201,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32 // Step 2: compute g if (betas[m - 1] != 1) { beta_m_pow = 1; - x = (size_t) (1 << m_f); + x = 1 << m_f; for (i = 1; i < x; ++i) { beta_m_pow = PQCLEAN_HQCRMRS192_AVX2_gf_mul(beta_m_pow, betas[m - 1]); f[i] = PQCLEAN_HQCRMRS192_AVX2_gf_mul(beta_m_pow, f[i]); @@ -223,7 +223,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32 // Step 5 fft_rec(u, f0, (f_coeffs + 1) / 2, m - 1, m_f - 1, deltas); - k = (size_t) (1 << ((m - 1) & 0xf)); // &0xf is to let the compiler know that m-1 is small. + k = 1 << ((m - 1) & 0xf); // &0xf is to let the compiler know that m-1 is small. if (f_coeffs <= 3) { // 3-coefficient polynomial f case: f1 is constant w[0] = u[0]; w[k] = u[0] ^ f1[0]; @@ -299,7 +299,7 @@ void PQCLEAN_HQCRMRS192_AVX2_fft(uint16_t *w, const uint16_t *f, size_t f_coeffs fft_rec(u, f0, (f_coeffs + 1) / 2, PARAM_M - 1, PARAM_FFT - 1, deltas); fft_rec(v, f1, f_coeffs / 2, PARAM_M - 1, PARAM_FFT - 1, deltas); - k = (size_t) (1 << (PARAM_M - 1)); + k = 1 << (PARAM_M - 1); // Step 6, 7 and error polynomial computation memcpy(w + k, v, 2 * k); @@ -334,7 +334,7 @@ void PQCLEAN_HQCRMRS192_AVX2_fft_retrieve_error_poly(uint8_t *error, const uint1 compute_fft_betas(gammas); compute_subset_sums(gammas_sums, gammas, PARAM_M - 1); - k = (size_t) (1 << (PARAM_M - 1)); + k = 1 << (PARAM_M - 1); error[0] ^= 1 ^ ((uint16_t) - w[0] >> 15); error[0] ^= 1 ^ ((uint16_t) - w[k] >> 15); diff --git a/crypto_kem/hqc-rmrs-192/clean/fft.c b/crypto_kem/hqc-rmrs-192/clean/fft.c index b89fd834..90a7789f 100644 --- a/crypto_kem/hqc-rmrs-192/clean/fft.c +++ b/crypto_kem/hqc-rmrs-192/clean/fft.c @@ -30,7 +30,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32 static void compute_fft_betas(uint16_t *betas) { size_t i; for (i = 0; i < PARAM_M - 1; ++i) { - betas[i] = (uint16_t) (1 << (PARAM_M - 1 - i)); + betas[i] = 1 << (PARAM_M - 1 - i); } } @@ -133,7 +133,7 @@ static void radix_big(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_ size_t i, n; - n = (size_t) (1 << (m_f - 2)); + n = 1 << (m_f - 2); memcpy(Q, f + 3 * n, 2 * n); memcpy(Q + n, f + 3 * n, 2 * n); memcpy(R, f, 4 * n); @@ -201,7 +201,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32 // Step 2: compute g if (betas[m - 1] != 1) { beta_m_pow = 1; - x = (size_t) (1 << m_f); + x = 1 << m_f; for (i = 1; i < x; ++i) { beta_m_pow = PQCLEAN_HQCRMRS192_CLEAN_gf_mul(beta_m_pow, betas[m - 1]); f[i] = PQCLEAN_HQCRMRS192_CLEAN_gf_mul(beta_m_pow, f[i]); @@ -223,7 +223,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32 // Step 5 fft_rec(u, f0, (f_coeffs + 1) / 2, m - 1, m_f - 1, deltas); - k = (size_t) (1 << ((m - 1) & 0xf)); // &0xf is to let the compiler know that m-1 is small. + k = 1 << ((m - 1) & 0xf); // &0xf is to let the compiler know that m-1 is small. if (f_coeffs <= 3) { // 3-coefficient polynomial f case: f1 is constant w[0] = u[0]; w[k] = u[0] ^ f1[0]; @@ -299,7 +299,7 @@ void PQCLEAN_HQCRMRS192_CLEAN_fft(uint16_t *w, const uint16_t *f, size_t f_coeff fft_rec(u, f0, (f_coeffs + 1) / 2, PARAM_M - 1, PARAM_FFT - 1, deltas); fft_rec(v, f1, f_coeffs / 2, PARAM_M - 1, PARAM_FFT - 1, deltas); - k = (size_t) (1 << (PARAM_M - 1)); + k = 1 << (PARAM_M - 1); // Step 6, 7 and error polynomial computation memcpy(w + k, v, 2 * k); @@ -334,7 +334,7 @@ void PQCLEAN_HQCRMRS192_CLEAN_fft_retrieve_error_poly(uint8_t *error, const uint compute_fft_betas(gammas); compute_subset_sums(gammas_sums, gammas, PARAM_M - 1); - k = (size_t) (1 << (PARAM_M - 1)); + k = 1 << (PARAM_M - 1); error[0] ^= 1 ^ ((uint16_t) - w[0] >> 15); error[0] ^= 1 ^ ((uint16_t) - w[k] >> 15); diff --git a/crypto_kem/hqc-rmrs-256/avx2/fft.c b/crypto_kem/hqc-rmrs-256/avx2/fft.c index 2cde4848..ab226c95 100644 --- a/crypto_kem/hqc-rmrs-256/avx2/fft.c +++ b/crypto_kem/hqc-rmrs-256/avx2/fft.c @@ -30,7 +30,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32 static void compute_fft_betas(uint16_t *betas) { size_t i; for (i = 0; i < PARAM_M - 1; ++i) { - betas[i] = (uint16_t) (1 << (PARAM_M - 1 - i)); + betas[i] = 1 << (PARAM_M - 1 - i); } } @@ -133,7 +133,7 @@ static void radix_big(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_ size_t i, n; - n = (size_t) (1 << (m_f - 2)); + n = 1 << (m_f - 2); memcpy(Q, f + 3 * n, 2 * n); memcpy(Q + n, f + 3 * n, 2 * n); memcpy(R, f, 4 * n); @@ -201,7 +201,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32 // Step 2: compute g if (betas[m - 1] != 1) { beta_m_pow = 1; - x = (size_t) (1 << m_f); + x = 1 << m_f; for (i = 1; i < x; ++i) { beta_m_pow = PQCLEAN_HQCRMRS256_AVX2_gf_mul(beta_m_pow, betas[m - 1]); f[i] = PQCLEAN_HQCRMRS256_AVX2_gf_mul(beta_m_pow, f[i]); @@ -223,7 +223,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32 // Step 5 fft_rec(u, f0, (f_coeffs + 1) / 2, m - 1, m_f - 1, deltas); - k = (size_t) (1 << ((m - 1) & 0xf)); // &0xf is to let the compiler know that m-1 is small. + k = 1 << ((m - 1) & 0xf); // &0xf is to let the compiler know that m-1 is small. if (f_coeffs <= 3) { // 3-coefficient polynomial f case: f1 is constant w[0] = u[0]; w[k] = u[0] ^ f1[0]; @@ -299,7 +299,7 @@ void PQCLEAN_HQCRMRS256_AVX2_fft(uint16_t *w, const uint16_t *f, size_t f_coeffs fft_rec(u, f0, (f_coeffs + 1) / 2, PARAM_M - 1, PARAM_FFT - 1, deltas); fft_rec(v, f1, f_coeffs / 2, PARAM_M - 1, PARAM_FFT - 1, deltas); - k = (size_t) (1 << (PARAM_M - 1)); + k = 1 << (PARAM_M - 1); // Step 6, 7 and error polynomial computation memcpy(w + k, v, 2 * k); @@ -334,7 +334,7 @@ void PQCLEAN_HQCRMRS256_AVX2_fft_retrieve_error_poly(uint8_t *error, const uint1 compute_fft_betas(gammas); compute_subset_sums(gammas_sums, gammas, PARAM_M - 1); - k = (size_t) (1 << (PARAM_M - 1)); + k = 1 << (PARAM_M - 1); error[0] ^= 1 ^ ((uint16_t) - w[0] >> 15); error[0] ^= 1 ^ ((uint16_t) - w[k] >> 15); diff --git a/crypto_kem/hqc-rmrs-256/clean/fft.c b/crypto_kem/hqc-rmrs-256/clean/fft.c index fe821b9e..33e2f2ba 100644 --- a/crypto_kem/hqc-rmrs-256/clean/fft.c +++ b/crypto_kem/hqc-rmrs-256/clean/fft.c @@ -30,7 +30,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32 static void compute_fft_betas(uint16_t *betas) { size_t i; for (i = 0; i < PARAM_M - 1; ++i) { - betas[i] = (uint16_t) (1 << (PARAM_M - 1 - i)); + betas[i] = 1 << (PARAM_M - 1 - i); } } @@ -133,7 +133,7 @@ static void radix_big(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_ size_t i, n; - n = (size_t) (1 << (m_f - 2)); + n = 1 << (m_f - 2); memcpy(Q, f + 3 * n, 2 * n); memcpy(Q + n, f + 3 * n, 2 * n); memcpy(R, f, 4 * n); @@ -201,7 +201,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32 // Step 2: compute g if (betas[m - 1] != 1) { beta_m_pow = 1; - x = (size_t) (1 << m_f); + x = 1 << m_f; for (i = 1; i < x; ++i) { beta_m_pow = PQCLEAN_HQCRMRS256_CLEAN_gf_mul(beta_m_pow, betas[m - 1]); f[i] = PQCLEAN_HQCRMRS256_CLEAN_gf_mul(beta_m_pow, f[i]); @@ -223,7 +223,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32 // Step 5 fft_rec(u, f0, (f_coeffs + 1) / 2, m - 1, m_f - 1, deltas); - k = (size_t) (1 << ((m - 1) & 0xf)); // &0xf is to let the compiler know that m-1 is small. + k = 1 << ((m - 1) & 0xf); // &0xf is to let the compiler know that m-1 is small. if (f_coeffs <= 3) { // 3-coefficient polynomial f case: f1 is constant w[0] = u[0]; w[k] = u[0] ^ f1[0]; @@ -299,7 +299,7 @@ void PQCLEAN_HQCRMRS256_CLEAN_fft(uint16_t *w, const uint16_t *f, size_t f_coeff fft_rec(u, f0, (f_coeffs + 1) / 2, PARAM_M - 1, PARAM_FFT - 1, deltas); fft_rec(v, f1, f_coeffs / 2, PARAM_M - 1, PARAM_FFT - 1, deltas); - k = (size_t) (1 << (PARAM_M - 1)); + k = 1 << (PARAM_M - 1); // Step 6, 7 and error polynomial computation memcpy(w + k, v, 2 * k); @@ -334,7 +334,7 @@ void PQCLEAN_HQCRMRS256_CLEAN_fft_retrieve_error_poly(uint8_t *error, const uint compute_fft_betas(gammas); compute_subset_sums(gammas_sums, gammas, PARAM_M - 1); - k = (size_t) (1 << (PARAM_M - 1)); + k = 1 << (PARAM_M - 1); error[0] ^= 1 ^ ((uint16_t) - w[0] >> 15); error[0] ^= 1 ^ ((uint16_t) - w[k] >> 15);