Skip to content

Commit

Permalink
Rename INLINE to MLK_INLINE for new functions here.
Browse files Browse the repository at this point in the history
Signed-off-by: Rod Chapman <rodchap@amazon.com>
  • Loading branch information
rod-chapman committed Feb 6, 2025
1 parent 413c9fa commit 4429485
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions mlkem/poly.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,13 +334,15 @@ void poly_mulcache_compute(poly_mulcache *x, const poly *a)
/* indexed by coeff1_index and coeff2_index, and the */
/* given value of zeta. */
/* */
/* NOTE that this function is marked INLINE for */
/* NOTE that this function is marked MLK_INLINE for */
/* compilation (for efficiency) and does not have */
/* contracts, so it is "inlined for proof" by CBMC */
/* This allows CBMC to keep track of the ranges of the */
/* modified coefficients in the calling functions. */
static INLINE void ct_butterfly(int16_t r[MLKEM_N], const unsigned coeff1_index,
const unsigned coeff2_index, const int16_t zeta)
static MLK_INLINE void ct_butterfly(int16_t r[MLKEM_N],
const unsigned coeff1_index,
const unsigned coeff2_index,
const int16_t zeta)
{
int16_t t1 = r[coeff1_index];
int16_t t2 = fqmul(r[coeff2_index], zeta);
Expand Down Expand Up @@ -411,9 +413,9 @@ __contract__(
}
}

static INLINE void ntt_layer45_butterfly(int16_t r[MLKEM_N],
const unsigned zeta_subtree_index,
const unsigned start)
static MLK_INLINE void ntt_layer45_butterfly(int16_t r[MLKEM_N],
const unsigned zeta_subtree_index,
const unsigned start)
__contract__(
requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
requires(zeta_subtree_index <= 7)
Expand Down Expand Up @@ -622,10 +624,10 @@ void poly_ntt(poly *p)
/* */
/* Like ct_butterfly(), this functions is inlined */
/* for both compilation and proof. */
static INLINE void gs_butterfly_reduce(int16_t r[MLKEM_N],
const unsigned coeff1_index,
const unsigned coeff2_index,
const int16_t zeta)
static MLK_INLINE void gs_butterfly_reduce(int16_t r[MLKEM_N],
const unsigned coeff1_index,
const unsigned coeff2_index,
const int16_t zeta)
{
const int16_t t1 = r[coeff1_index];
const int16_t t2 = r[coeff2_index];
Expand All @@ -635,10 +637,10 @@ static INLINE void gs_butterfly_reduce(int16_t r[MLKEM_N],

/* As gs_butterfly_reduce(), but does not reduce the */
/* coefficient denoted by coeff1_index */
static INLINE void gs_butterfly_defer(int16_t r[MLKEM_N],
const unsigned coeff1_index,
const unsigned coeff2_index,
const int16_t zeta)
static MLK_INLINE void gs_butterfly_defer(int16_t r[MLKEM_N],
const unsigned coeff1_index,
const unsigned coeff2_index,
const int16_t zeta)
{
const int16_t t1 = r[coeff1_index];
const int16_t t2 = r[coeff2_index];
Expand Down Expand Up @@ -715,9 +717,9 @@ __contract__(
}


static INLINE void invntt_layer54_butterfly(int16_t r[MLKEM_N],
const unsigned zeta_index,
const unsigned start)
static MLK_INLINE void invntt_layer54_butterfly(int16_t r[MLKEM_N],
const unsigned zeta_index,
const unsigned start)
__contract__(
requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
requires(zeta_index <= 7)
Expand Down

0 comments on commit 4429485

Please sign in to comment.