POLY: add erase_polynom() function
This commit is contained in:
parent
8ea687bdf5
commit
2300587fec
14
src/poly.c
14
src/poly.c
@ -134,6 +134,20 @@ pb_poly *build_polynom(int const * const c,
|
||||
return new_poly;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets all the polynomial coefficients to +0.
|
||||
*
|
||||
* @param poly the polynomial
|
||||
* @param len the length of the polynomial
|
||||
*/
|
||||
void erase_polynom(pb_poly *poly, size_t len)
|
||||
{
|
||||
for (unsigned int i = 0; i < len ; i++) {
|
||||
mp_set(&(poly->terms[i]), 0);
|
||||
mp_abs(&(poly->terms[i]), &(poly->terms[i]));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This deletes the internal structure of a polynomial,
|
||||
* and frees the pointer. Don't call this on stack variables,
|
||||
|
@ -126,6 +126,8 @@ pb_poly *build_polynom(int const * const c,
|
||||
const size_t len,
|
||||
ntru_context *ctx);
|
||||
|
||||
void erase_polynom(pb_poly *poly, size_t len);
|
||||
|
||||
void delete_polynom(pb_poly *new_poly);
|
||||
|
||||
void pb_starmultiply(pb_poly *a,
|
||||
|
Loading…
Reference in New Issue
Block a user