diff options
author | Matt Turner <mattst88@gmail.com> | 2008-11-12 23:25:26 +0000 |
---|---|---|
committer | Matt Turner <mattst88@gmail.com> | 2008-11-12 23:25:26 +0000 |
commit | 37438ca202a9a1f4e782f1d1803686fc6b65e918 (patch) | |
tree | 7cf856979306a32f7817b528b306539cf914e93b /stringsort.c | |
parent | 7a57eeccd8ded740d88aba3ea9dcb09050983dd0 (diff) |
Move static function prototypes from nbench1.h to appropriate files
git-svn-id: svn://mattst88.com/svn/cleanbench/trunk@14 0d43b9a7-5ab2-4d7b-af9d-f64450cef757
Diffstat (limited to 'stringsort.c')
-rw-r--r-- | stringsort.c | 52 |
1 files changed, 38 insertions, 14 deletions
diff --git a/stringsort.c b/stringsort.c index 5d7c67d..7670dea 100644 --- a/stringsort.c +++ b/stringsort.c @@ -1,21 +1,45 @@ -#include <stdint.h> -/*#include <stdio.h> +#include <stdio.h> #include <stdlib.h> -#include <string.h> -#include <strings.h> -#include <math.h>*/ +#include <stdint.h> +#include <math.h> +#include <limits.h> + #include "nmglobal.h" #include "nbench1.h" -#ifdef DEBUG -static int numsort_status=0; -static int stringsort_status=0; -#endif /******************** ** STRING HEAPSORT ** ********************/ +static unsigned long DoStringSortIteration(unsigned char *arraybase, + unsigned int numarrays, + unsigned long arraysize); +static unsigned long *LoadStringArray(unsigned char *strarray, + unsigned int numarrays, + unsigned long *strings, + unsigned long arraysize); +static void stradjust(unsigned long *optrarray, + unsigned char *strarray, + unsigned long nstrings, + unsigned long i, + unsigned char l); +static void StrHeapSort(unsigned long *optrarray, + unsigned char *strarray, + unsigned long numstrings, + unsigned long bottom, + unsigned long top); +static int str_is_less(unsigned long *optrarray, + unsigned char *strarray, + unsigned long numstrings, + unsigned long a, + unsigned long b); +static void strsift(unsigned long *optrarray, + unsigned char *strarray, + unsigned long numstrings, + unsigned long i, + unsigned long j); + /***************** ** DoStringSort ** ****************** @@ -504,18 +528,18 @@ slen=strncmp((char *)(strarray+*(optrarray+a)), if(slen==0) { /* - ** They match. Return true if the length of a + ** They match. Return TRUE if the length of a ** is greater than the length of b. */ if(*(strarray+*(optrarray+a)) > *(strarray+*(optrarray+b))) - return(TRUE); - return(FALSE); + return TRUE; + return FALSE; } -if(slen<0) return(TRUE); /* a is strictly less than b */ +if(slen<0) return TRUE; /* a is strictly less than b */ -return(FALSE); /* Only other possibility */ +return FALSE; /* Only other possibility */ } /************ |