From 34edabbf495e0222c59937973ab2bfecc8e32dd6 Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Fri, 14 Nov 2008 23:03:36 +0000 Subject: Remove adjust struct member in favor of a local static variable git-svn-id: svn://mattst88.com/svn/cleanbench/trunk@44 0d43b9a7-5ab2-4d7b-af9d-f64450cef757 --- idea.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'idea.c') diff --git a/idea.c b/idea.c index 335e1e5..2bc7f9b 100644 --- a/idea.c +++ b/idea.c @@ -59,20 +59,18 @@ static void cipher_idea(uint16_t in[4], uint16_t out[4], IDEAkey Z); void DoIDEA(void) { - const char *context = "CPU:IDEA"; - IDEAStruct *locideastruct=&global_ideastruct; /* Loc pointer to global structure */ - clock_t total_time = 0; - int iterations = 0; - unsigned char *plain1 = NULL; /* First plaintext buffer */ - unsigned char *crypt1 = NULL; /* Encryption buffer */ - unsigned char *plain2 = NULL; /* Second plaintext buffer */ - IDEAkey Z,DK; - uint16_t userkey[8]; - int i; + const char* context = "CPU:IDEA"; + IDEAStruct* locideastruct=&global_ideastruct; /* Loc pointer to global structure */ + unsigned char* plain1 = NULL; /* First plaintext buffer */ + unsigned char* crypt1 = NULL; /* Encryption buffer */ + unsigned char* plain2 = NULL; /* Second plaintext buffer */ + clock_t total_time = 0; + int iterations = 0; + IDEAkey Z, DK; + uint16_t userkey[8]; + int i; + static int is_adjusted = FALSE; - /* - ** Re-init random-number generator. - */ randnum(3); /* @@ -129,8 +127,8 @@ DoIDEA(void) /* ** See if we need to perform self adjustment loop. */ - if (locideastruct->adjust == FALSE) { - locideastruct->adjust = TRUE; + if (is_adjusted == FALSE) { + is_adjusted = TRUE; /* ** Do self-adjustment. This involves initializing the ** # of loops and increasing the loop count until we -- cgit v1.2.3