36 if (gamma2 == (
MLDSA_Q - 1) / 32) {
37 a1 = (a1 * 1025 + (1 << 21)) >> 22;
42 a1 = (a1 * 11275 + (1 << 23)) >> 24;
43 a1 ^= ((43 - a1) >> 31) & a1;
46 *a0 = a - a1 * 2 * gamma2;
53 if ((a0 > gamma2) || (a0 < -gamma2) || ((a0 == -gamma2) && (a1 != 0))) {
68 if (gamma2 == (
MLDSA_Q - 1) / 32) {
79 return (a1 == 43) ? 0 : a1 + 1;
82 return (a1 == 0) ? 43 : a1 - 1;
89 for (uint32_t i = 0U; i <
MLDSA_N; i++) {
99 for (uint32_t i = 0U; i <
MLDSA_N; i++) {
109 for (uint32_t i = 0U; i <
MLDSA_N; i++) {
int32_t MLDSA_ROUNDING_power2round(int32_t a, int32_t *a0)
For coefficient a, compute high and low bits a0, a1 such that a mod q = a1*2^D + a0,...
void MLDSA_ROUNDING_poly_use_hint(mldsa_poly *b, const mldsa_poly *a, const mldsa_poly *h, int32_t gamma2)
Applies use_hint to all coefficients of a polynomial.
void MLDSA_ROUNDING_poly_decompose(mldsa_poly *a1, mldsa_poly *a0, const mldsa_poly *a, int32_t gamma2)
Applies decompose to all coefficients of a polynomial.
int32_t MLDSA_ROUNDING_decompose(int32_t a, int32_t *a0, int32_t gamma2)
For coefficient a, compute high and low bits a0, a1 such that a mod q = a1*ALPHA + a0,...
uint32_t MLDSA_ROUNDING_make_hint(int32_t a0, int32_t a1, int32_t gamma2)
Compute hint bit. Returns 1 if adding ct0 to w - ct0 would change the high bits (i....
int32_t MLDSA_ROUNDING_use_hint(int32_t a, uint32_t hint, int32_t gamma2)
Correct high bits using hint.
void MLDSA_ROUNDING_poly_power2round(mldsa_poly *a1, mldsa_poly *a0, const mldsa_poly *a)
Applies power2round to all coefficients of a polynomial.
Polynomial with MLDSA_N int32_t coefficients.