# HG changeset patch # User Jim Meyering # Date 1205591079 -3600 # Node ID bf79dbf4257f3e1dc09ec5397fa5c68495bac9ce # Parent 0675687268a7c6b0c56185cdff778e799633b9a0 sha1.c, md5.c: Hoist a redundant expression. * lib/sha1.c (sha1_process_bytes): AND-off the low bits in "ctx->buflen" only once, before calling *_process_block. * lib/md5.c (md5_process_bytes): Likewise. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-03-15 Jim Meyering + + sha1.c, md5.c: Hoist a redundant expression. + * lib/sha1.c (sha1_process_bytes): AND-off the low bits in + "ctx->buflen" only once, before calling *_process_block. + * lib/md5.c (md5_process_bytes): Likewise. + 2008-03-14 Eric Blake Bump copyright year in files generated by gnulib-tool. diff --git a/lib/md5.c b/lib/md5.c --- a/lib/md5.c +++ b/lib/md5.c @@ -230,9 +230,9 @@ if (ctx->buflen > 64) { - md5_process_block (ctx->buffer, ctx->buflen & ~63, ctx); + ctx->buflen &= 63; + md5_process_block (ctx->buffer, ctx->buflen, ctx); - ctx->buflen &= 63; /* The regions in the following copy operation cannot overlap. */ memcpy (ctx->buffer, &((char *) ctx->buffer)[(left_over + add) & ~63], diff --git a/lib/sha1.c b/lib/sha1.c --- a/lib/sha1.c +++ b/lib/sha1.c @@ -217,9 +217,9 @@ if (ctx->buflen > 64) { - sha1_process_block (ctx->buffer, ctx->buflen & ~63, ctx); + ctx->buflen &= 63; + sha1_process_block (ctx->buffer, ctx->buflen, ctx); - ctx->buflen &= 63; /* The regions in the following copy operation cannot overlap. */ memcpy (ctx->buffer, &((char *) ctx->buffer)[(left_over + add) & ~63],