changeset 9795:bf79dbf4257f

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.
author Jim Meyering <meyering@redhat.com>
date Sat, 15 Mar 2008 15:24:39 +0100
parents 0675687268a7
children 4ee5860b30b8
files ChangeLog lib/md5.c lib/sha1.c
diffstat 3 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-03-15  Jim Meyering  <meyering@redhat.com>
+
+	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  <ebb9@byu.net>
 
 	Bump copyright year in files generated by gnulib-tool.
--- 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],
--- 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],