POLY: add erase_polynom() function
This commit is contained in:
parent
f8b1649279
commit
ed1fb0f0a9
14
src/poly.c
14
src/poly.c
@ -134,6 +134,20 @@ pb_poly *build_polynom(int const * const c,
|
|||||||
return new_poly;
|
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,
|
* This deletes the internal structure of a polynomial,
|
||||||
* and frees the pointer. Don't call this on stack variables,
|
* 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,
|
const size_t len,
|
||||||
ntru_context *ctx);
|
ntru_context *ctx);
|
||||||
|
|
||||||
|
void erase_polynom(pb_poly *poly, size_t len);
|
||||||
|
|
||||||
void delete_polynom(pb_poly *new_poly);
|
void delete_polynom(pb_poly *new_poly);
|
||||||
|
|
||||||
void pb_starmultiply(pb_poly *a,
|
void pb_starmultiply(pb_poly *a,
|
||||||
|
Loading…
Reference in New Issue
Block a user