From: Niels Möller Date: Tue, 16 Apr 2013 05:51:00 +0000 (+0200) Subject: Generalize INCREMENT macro, allow size == 1. X-Git-Tag: nettle_2.7_release_20130424~48 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e4f490c940afc239268de2d0c9a8e8f6d786442c;p=thirdparty%2Fnettle.git Generalize INCREMENT macro, allow size == 1. --- diff --git a/ChangeLog b/ChangeLog index 38d313e9..d069e75a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-16 Niels Möller + + * macros.h (INCREMENT): Allow size == 1. + 2013-04-15 Niels Möller * x86_64/umac-nh.asm: New file. 4.4 time speedup. diff --git a/macros.h b/macros.h index ee206043..38b9e219 100644 --- 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)