ASCII->POLY: rm redundant counter

This commit is contained in:
hasufell 2014-05-30 01:37:03 +02:00
parent 0f2f2aec06
commit 82ae4a7a52
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020
1 changed files with 3 additions and 5 deletions

View File

@ -309,19 +309,17 @@ poly_to_ascii(fmpz_poly_t poly,
{
string *result_string = ntru_malloc(sizeof(*result_string));
char *string_rep = ntru_malloc(CHAR_SIZE * (ctx->N));
uint32_t i = 0;
for (uint32_t j = 0; j < ctx->N; j++) {
uint8_t coeff = fmpz_poly_get_coeff_ui(poly, j);
if (coeff == ctx->q)
string_rep[i] = '\0';
string_rep[j] = '\0';
else
string_rep[i] = (char)coeff;
i++;
string_rep[j] = (char)coeff;
}
result_string->ptr = string_rep;
result_string->len = i;
result_string->len = ctx->N;
return result_string;
}