]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
Generalize INCREMENT macro, allow size == 1.
authorNiels Möller <nisse@lysator.liu.se>
Tue, 16 Apr 2013 05:51:00 +0000 (07:51 +0200)
committerNiels Möller <nisse@lysator.liu.se>
Tue, 16 Apr 2013 05:51:00 +0000 (07:51 +0200)
ChangeLog
macros.h

index 38d313e9281ab505821d09e23a966f6c10d2591d..d069e75addeca783d4455f60652433b6a310bb2b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-04-16  Niels Möller  <nisse@lysator.liu.se>
+
+       * macros.h (INCREMENT): Allow size == 1.
+
 2013-04-15  Niels Möller  <nisse@lysator.liu.se>
 
        * x86_64/umac-nh.asm: New file. 4.4 time speedup.
index ee2060431d6d2f0dcde6ea69b55b9ccfb74f2ba2..38b9e2198152a393ca92907487b0c718bda582f6 100644 (file)
--- a/macros.h
+++ b/macros.h
@@ -145,16 +145,14 @@ do {                                              \
 
 #define ROTL64(n,x) (((x)<<(n)) | ((x)>>(64-(n))))
 
-/* Requires that size >= 2 */
+/* Requires that size > 0 */
 #define INCREMENT(size, ctr)                   \
   do {                                         \
     unsigned increment_i = (size) - 1;         \
     if (++(ctr)[increment_i] == 0)             \
-      {                                                \
-       while (++(ctr)[--increment_i] == 0      \
-              && increment_i > 0)              \
-         ;                                     \
-      }                                                \
+      while (increment_i > 0                   \
+            && ++(ctr)[--increment_i] == 0 )   \
+       ;                                       \
   } while (0)