Optimize bn_correct_top.
authorAndy Polyakov <appro@openssl.org>
Wed, 15 Oct 2008 10:48:52 +0000 (10:48 +0000)
committerAndy Polyakov <appro@openssl.org>
Wed, 15 Oct 2008 10:48:52 +0000 (10:48 +0000)
crypto/bn/bn.h

index 4749c52341f7e55aa8f0a0aa06086e1a10b1ec73..dc0debb85afbe2a079632216d4fd64c0a410115b 100644 (file)
@@ -752,10 +752,12 @@ int RAND_pseudo_bytes(unsigned char *buf,int num);
 #define bn_correct_top(a) \
         { \
         BN_ULONG *ftl; \
 #define bn_correct_top(a) \
         { \
         BN_ULONG *ftl; \
-       if ((a)->top > 0) \
+       int top = (a)->top; \
+       if (top > 0) \
                { \
                { \
-               for (ftl= &((a)->d[(a)->top-1]); (a)->top > 0; (a)->top--) \
-               if (*(ftl--)) break; \
+               for (ftl= &((a)->d[top-1]); top > 0; top--) \
+                       if (*(ftl--)) break; \
+               (a)->top = top; \
                } \
        bn_pollute(a); \
        }
                } \
        bn_pollute(a); \
        }