From 256b3e9c5fe94e96873cc54e7d7b0c630b68c191 Mon Sep 17 00:00:00 2001 From: Andy Polyakov Date: Wed, 15 Oct 2008 10:48:52 +0000 Subject: [PATCH] Optimize bn_correct_top. --- crypto/bn/bn.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crypto/bn/bn.h b/crypto/bn/bn.h index 4749c52341..dc0debb85a 100644 --- a/crypto/bn/bn.h +++ b/crypto/bn/bn.h @@ -752,10 +752,12 @@ int RAND_pseudo_bytes(unsigned char *buf,int num); #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); \ } -- 2.40.0