ASCII->POLY: rm redundant counter
This commit is contained in:
parent
0f2f2aec06
commit
82ae4a7a52
@ -309,19 +309,17 @@ poly_to_ascii(fmpz_poly_t poly,
|
|||||||
{
|
{
|
||||||
string *result_string = ntru_malloc(sizeof(*result_string));
|
string *result_string = ntru_malloc(sizeof(*result_string));
|
||||||
char *string_rep = ntru_malloc(CHAR_SIZE * (ctx->N));
|
char *string_rep = ntru_malloc(CHAR_SIZE * (ctx->N));
|
||||||
uint32_t i = 0;
|
|
||||||
|
|
||||||
for (uint32_t j = 0; j < ctx->N; j++) {
|
for (uint32_t j = 0; j < ctx->N; j++) {
|
||||||
uint8_t coeff = fmpz_poly_get_coeff_ui(poly, j);
|
uint8_t coeff = fmpz_poly_get_coeff_ui(poly, j);
|
||||||
if (coeff == ctx->q)
|
if (coeff == ctx->q)
|
||||||
string_rep[i] = '\0';
|
string_rep[j] = '\0';
|
||||||
else
|
else
|
||||||
string_rep[i] = (char)coeff;
|
string_rep[j] = (char)coeff;
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
result_string->ptr = string_rep;
|
result_string->ptr = string_rep;
|
||||||
result_string->len = i;
|
result_string->len = ctx->N;
|
||||||
|
|
||||||
return result_string;
|
return result_string;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user