From: Loup Vaillant Date: Sun, 5 Jan 2020 20:32:41 +0000 (+0100) Subject: Rolled loop for zero initialisation X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=568437894a93a6f34b7e3cf21332683946c33902;p=Monocypher.git Rolled loop for zero initialisation - Compilers optimise loops better. - We save one line of code this way. (This is a nitpick: in practice, this doesn't change a thing.) --- diff --git a/src/monocypher.c b/src/monocypher.c index 53cbc48..7e55f24 100644 --- a/src/monocypher.c +++ b/src/monocypher.c @@ -369,10 +369,9 @@ static void poly_block(crypto_poly1305_ctx *ctx) // (re-)initialises the input counter and input buffer static void poly_clear_c(crypto_poly1305_ctx *ctx) { - ctx->c[0] = 0; - ctx->c[1] = 0; - ctx->c[2] = 0; - ctx->c[3] = 0; + FOR (i, 0, 4) { + ctx->c[i] = 0; + } ctx->c_idx = 0; }