Commits

asc...@andrewschein.com  committed 762e57c

removed all the backup files from version control.

  • Participants
  • Parent commits 07eafaf

Comments (0)

Files changed (44)

File hsort/t/.back/Makefile~

-include ../defs.mk
-
-APPS=u1 s1 u2 s2 f4 f8 u4 s4 u8 s8
-SRC=$(patsubst %,%.c,$(wildcard $(APPS)))
-
-all : $(APPS)
-	echo $(SRC)
-
-u1  : hsort-cmp.c ../swap.c ../hsort.c $(SRC)  
-	gcc $(G) $(W) $(I) $(O) -o u1 u1.c 
-
-s1  : hsort-cmp.c ../swap.c ../hsort.c  $(SRC)
-	gcc $(G) $(W) $(I) $(O) -o s1 s1.c 
-
-u2  : hsort-cmp.c ../swap.c ../hsort.c  $(SRC)
-	gcc $(G) $(W) $(I) $(O) -o u2 u2.c 
-
-s2  : hsort-cmp.c ../swap.c ../hsort.c  $(SRC)
-	gcc $(G) $(W) $(I) $(O) -o s2 s2.c 
-
-f4  : hsort-cmp.c ../swap.c ../hsort.c  $(SRC)
-	gcc $(G) $(W) $(I) $(O) -o f4 f4.c 
-
-s4  : hsort-cmp.c ../swap.c ../hsort.c  $(SRC)
-	gcc $(G) $(W) $(I) $(O) -o s4 s4.c 
-
-u4  : hsort-cmp.c ../swap.c ../hsort.c  $(SRC)
-	gcc $(G) $(W) $(I) $(O) -o u4 u4.c 
-
-f8  : hsort-cmp.c ../swap.c ../hsort.c  $(SRC)
-	gcc $(G) $(W) $(I) $(O) -o f8 f8.c 
-
-u8  : hsort-cmp.c ../swap.c ../hsort.c  $(SRC)
-	gcc $(G) $(W) $(I) $(O) -o u8 u8.c 
-
-s8  : hsort-cmp.c ../swap.c ../hsort.c  $(SRC)
-	gcc $(G) $(W) $(I) $(O) -o s8 s8.c 
-
-clean :
-	rm -f $(APPS) hsort-cmp # hsort-3way-cmp 

File hsort/t/.back/cmp-all.sh~

-#!/bin/bash -e
-
-apps="u1 s1 u2 s2 u4 s4 f4 f8 s8 u8"
-
-for app in $apps ; do
-    export app
-    ./cmp.sh
-done
-

File hsort/t/.back/cmp.sh~

-#!/usr/bin/zsh -e
-
-echo "TESTING APP: " ${app:="f8"}
-APP=$app
-
-i=(10 100 1000 10000 100000 1000000 10000000 100000000 )
-t=(10000000 1000000 100000 10000 1000 100 10 3 1)
-sz=${#i[@]}
-c=1
-echo "Sort Comparison of unsigned integers on N numbers generating according to:"
-echo "RANDOM:    random integers"
-echo "BOUNDED:   random() % (N/4)"
-echo "SORTED:    sorted integers 1...N"
-echo "REVERSED:  sorted integers N...1"
-echo "IDENT:     all values of the array are \"1\""
-
-echo "\nRANDOM"
-echo "N               mysort (secs)   GLIBC (secs)    %impr"
-c=1
-while [ $c -lt $sz ] ; do
-    ./${APP} ${i[$c]} RAND ${t[$c]}  
-    c=$(( $c + 1 ))
-done;
-if [ ! $app = "f4" -a ! $app = "f8" ] ; then
-    echo "BOUNDED"
-    c=1
-    while [ $c -lt $sz ] ; do
-        ./${APP} ${i[$c]} BOUNDED ${t[$c]}  
-        c=$(( $c + 1 ))
-    done;
-fi;
-echo "SORTED"
-c=1
-while [ $c -lt $sz ] ; do
-    ./${APP} ${i[$c]} SORTED ${t[$c]}  
-    c=$(( $c + 1 ))
-done;
-echo "REVERSED"
-c=1
-while [ $c -lt $sz ] ; do
-    ./${APP} ${i[$c]} REVERSE ${t[$c]}  
-    c=$(( $c + 1 ))
-done;
-echo "IDENT"
-c=1
-while [ $c -lt $sz ] ; do
-    ./${APP} ${i[$c]} IDENT ${t[$c]}  
-    c=$(( $c + 1 ))
-done;

File hsort/t/.back/f4.c~

-#include <math.h>
-#define ISNAN(x)  isnan((x))
-#define TY float
-#define TY_FMT "%f"
-#include "../ufunc/f4_qsort.c"
-#define QS f4_qsort
-#include "qsort-cmp.c"

File hsort/t/.back/f8.c~

-#include <math.h>
-#define ISNAN(x) !isfinite((x))
-#define TY double
-#define TY_FMT "%lf"
-#include "../ufunc/f8_hsort.c"
-#define HS f8_hsort
-#include "hsort-cmp.c"

File hsort/t/.back/hsort-cmp.c~

-/* Test harness for qsort.c, useful for all C base types up to 64 bits.  
-   Uses macros for polymorphism.
-   To use, define macro TY (e.g. #define TY float) then #include this file. */
-
-#ifndef HSORT_CMP
-#define HSORT_CMP
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include <string.h>
-#include <sys/time.h>
-#include "datetime/TIME.c"
-#include <unistd.h>
-#ifndef ISNAN
-#define CHECKNAN(x) (x)
-#else 
-#define CHECKNAN(x) (ISNAN((x)) ? 0 : (x)) 
-#endif
-
-enum generator {RAND,BOUNDED,SORTED, REVERSE ,IDENT} ;
-
-long long k,j;
-const char* usage="qsort-cmp dist N trials\n"
-"dist is one of: RAND, BOUNDED , SORTED, REVSORTED, IDENT\n"
-"N:              size of the array.\n"
-"trials:         how many trials to do.  Necessary for small N.\n";
-
-int parseDist(char* dist_str) {
-    if (!strcmp("BOUNDED",dist_str)) 
-        return BOUNDED;
-    else if (!strcmp("RAND",dist_str)) 
-        return RAND;
-    else if (!strcmp("SORTED",dist_str))
-        return SORTED;
-    else if (!strcmp("REVERSE",dist_str))
-        return REVERSE;
-    else if (!strcmp("IDENT",dist_str))
-        return IDENT;
-    else fprintf(stderr,"dist argument mismatch.\n%s\n",usage),exit(1);
-}
-
-void randomized(TY *x, long long n) {
-    long long i; 
-    union { char l[8]; TY t; } u;
-    for (i = 0; i < n; i++) {
-        u.l[0] =  random();
-        u.l[1] =  random();
-        u.l[2] =  random();
-        u.l[3] =  random();
-	u.l[4] =  random();
-        u.l[5] =  random();
-        u.l[6] =  random();
-        u.l[7] =  random();
-        
-	x[i]   =  u.t; 
-        x[i]   =  CHECKNAN(x[i]);
-    }
-}
-
-void bounded(TY *x, long long n) {
-    long long i;
-    union { long l[2]; TY t;} u;
-    for (i = 0; i < n; i++) {
-        u.l[0] = (random() % (n/4));
-        u.l[1] = (random() % (n/4));
-        x[i]   = u.t;
-        x[i]   = CHECKNAN(x[i]);
-    }
-}
-
-void identity(TY *x, long long n) {
-    long long i;
-    for (i = 0; i < n; i++) {
-        x[i] = 1;
-    }
-}
-
-void reverse(TY *x, long long n) {
-    long long i;
-    for (i = 0; i < n; i++) 
-        x[i] = n - i - 1;
-}
-
-void sorted(TY *x, long long n) {
-    long long i;
-    for (i = 0; i < n; i++) 
-        x[i] = i;
-}
-
-int compare(const void *a, const void *b) {
-    TY A = *(const TY *)a, B = *(const TY *)b;
-    if (A > B) return 1;
-    if (B < A) return -1;
-    return 0;
-}
-
-void fill(char* dist, TY* array1,long n) {
-    switch (parseDist(dist)) {
-    case RAND : 
-        randomized(array1,n) ; break;
-    case BOUNDED :
-        bounded(array1,n) ;    break;
-    case SORTED :
-        sorted(array1,n)  ;    break;
-    case REVERSE :
-        reverse(array1,n) ;    break;
-    case IDENT :
-        identity(array1,n) ;    break;
-    default :
-        fprintf(stderr,"dist match error.\n"), exit(1);
-    }
-}
-
-void checkWork(const char *name, TY *a, long long n ) {
-    long long i,j;
-    for (i = 1; i < n; i++) {
-        if (a[i-1] > a[i]) {
-            fprintf (stderr,"%s: %lld x %zd: failure at offset %lld\n", name, n,
-                     sizeof(TY), i);
-            for (j=0; j < n;j++) {
-                if (j != i) fprintf(stderr,TY_FMT " ",a[j]);
-                else { fprintf(stderr,TY_FMT "* ", a[j]); }
-            }
-            
-            fprintf(stderr,"\n"); 
-            free(a);
-            exit(1);
-        }
-    }
-}
-
-int main (int argc, char **argv)
-{
-    if (argc < 4) fprintf(stderr,"too few arguments: %d\n%s",argc,usage) , exit(1);
-    long i=j=0; long n=strtoul(argv[1],NULL,10);
-    long num_trials = strtoul(argv[3],NULL,10);
-    double start, end, m_tot=0, g_tot=0;
-    TY *array1 = (TY*) malloc (n * sizeof(TY));
-    if (array1 == NULL)
-        {
-            fprintf (stderr,"%d x %zd: no memory\n", argc, sizeof(TY));
-            return 1;
-        }
-    if (getenv("SEED")) srand(time(NULL)); /* default is debugging mode. */
-    for (i = 0; i < num_trials; i++) {
-        fill(argv[2],array1,n);
-        start = TIME();
-        qsort (array1,n,sizeof(TY),&compare);
-        end   = TIME();
-        if (i) {
-            g_tot += end-start;
-        }  
-        checkWork("GNU",array1,n);
-    }
-    g_tot /= (double) (num_trials - 1);
-    
-    
-    for (i = 0; i < num_trials; i++) {
-        fill(argv[2],array1,n);
-        start = TIME();
-        HS(array1,n);
-        end   = TIME();
-        if (i) {
-            m_tot += end - start;
-        }    
-        checkWork("schein",array1,n);
-    
-    }
-    m_tot /= (double) (num_trials - 1);
-    
-        
-    
-    fprintf(stdout,"%10ld\t%5.10f\t%5.10f\t%2.2f\n",n,m_tot,g_tot,
-            100*((g_tot/m_tot) - 1));
-    free (array1);
-    return 0; 
-}
-#endif
-
-
-
-
-

File hsort/t/.back/qsort-cmp.c~

-/* Test harness for qsort.c, useful for all C base types up to 64 bits.  
-   Uses macros for polymorphism.
-   To use, define macro TY (e.g. #define TY float) then #include this file. */
-
-#ifndef QSORT_CMP
-#define QSORT_CMP
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include <string.h>
-#include <sys/time.h>
-#include "datetime/TIME.c"
-#include <unistd.h>
-#ifndef ISNAN
-#define CHECKNAN(x) (x)
-#else 
-#define CHECKNAN(x) (ISNAN((x)) ? 0 : (x)) 
-#endif
-
-enum generator {RAND,BOUNDED,SORTED, REVERSE ,IDENT} ;
-
-long long k,j;
-const char* usage="qsort-cmp dist N trials\n"
-"dist is one of: RAND, BOUNDED , SORTED, REVSORTED, IDENT\n"
-"N:              size of the array.\n"
-"trials:         how many trials to do.  Necessary for small N.\n";
-
-int parseDist(char* dist_str) {
-    if (!strcmp("BOUNDED",dist_str)) 
-        return BOUNDED;
-    else if (!strcmp("RAND",dist_str)) 
-        return RAND;
-    else if (!strcmp("SORTED",dist_str))
-        return SORTED;
-    else if (!strcmp("REVERSE",dist_str))
-        return REVERSE;
-    else if (!strcmp("IDENT",dist_str))
-        return IDENT;
-    else fprintf(stderr,"dist argument mismatch.\n%s\n",usage),exit(1);
-}
-
-void randomized(TY *x, long long n) {
-    long long i; 
-    union { char l[8]; TY t; } u;
-    for (i = 0; i < n; i++) {
-        u.l[0] =  random();
-        u.l[1] =  random();
-        u.l[2] =  random();
-        u.l[3] =  random();
-	u.l[4] =  random();
-        u.l[5] =  random();
-        u.l[6] =  random();
-        u.l[7] =  random();
-        
-	x[i]   =  u.t; 
-        x[i]   =  CHECKNAN(x[i]);
-    }
-}
-
-void bounded(TY *x, long long n) {
-    long long i;
-    union { long l[2]; TY t;} u;
-    for (i = 0; i < n; i++) {
-        u.l[0] = (random() % (n/4));
-        u.l[1] = (random() % (n/4));
-        x[i]   = u.t;
-        x[i]   = CHECKNAN(x[i]);
-    }
-}
-
-void identity(TY *x, long long n) {
-    long long i;
-    for (i = 0; i < n; i++) {
-        x[i] = 1;
-    }
-}
-
-void reverse(TY *x, long long n) {
-    long long i;
-    for (i = 0; i < n; i++) 
-        x[i] = n - i - 1;
-}
-
-void sorted(TY *x, long long n) {
-    long long i;
-    for (i = 0; i < n; i++) 
-        x[i] = i;
-}
-
-int compare(const void *a, const void *b) {
-    TY A = *(const TY *)a, B = *(const TY *)b;
-    if (A > B) return 1;
-    if (B < A) return -1;
-    return 0;
-}
-
-void fill(char* dist, TY* array1,long n) {
-    switch (parseDist(dist)) {
-    case RAND : 
-        randomized(array1,n) ; break;
-    case BOUNDED :
-        bounded(array1,n) ;    break;
-    case SORTED :
-        sorted(array1,n)  ;    break;
-    case REVERSE :
-        reverse(array1,n) ;    break;
-    case IDENT :
-        identity(array1,n) ;    break;
-    default :
-        fprintf(stderr,"dist match error.\n"), exit(1);
-    }
-}
-
-void checkWork(const char *name, TY *a, long long n ) {
-    long long i,j;
-    for (i = 1; i < n; i++) {
-        if (a[i-1] > a[i]) {
-            fprintf (stderr,"%s: %lld x %zd: failure at offset %lld\n", name, n,
-                     sizeof(TY), i);
-            for (j=0; j < n;j++) {
-                if (j != i) fprintf(stderr,TY_FMT " ",a[j]);
-                else { fprintf(stderr,TY_FMT "* ", a[j]); }
-            }
-            
-            fprintf(stderr,"\n"); 
-            free(a);
-            exit(1);
-        }
-    }
-}
-
-int main (int argc, char **argv)
-{
-    if (argc < 4) fprintf(stderr,"too few arguments: %d\n%s",argc,usage) , exit(1);
-    long i=j=0; long n=strtoul(argv[1],NULL,10);
-    long num_trials = strtoul(argv[3],NULL,10);
-    double start, end, m_tot=0, g_tot=0;
-    TY *array1 = (TY*) malloc (n * sizeof(TY));
-    if (array1 == NULL)
-        {
-            fprintf (stderr,"%d x %zd: no memory\n", argc, sizeof(TY));
-            return 1;
-        }
-    if (getenv("SEED")) srand(time(NULL)); /* default is debugging mode. */
-    for (i = 0; i < num_trials; i++) {
-        fill(argv[2],array1,n);
-        start = TIME();
-        qsort (array1,n,sizeof(TY),&compare);
-        end   = TIME();
-        if (i) {
-            g_tot += end-start;
-        }  
-        checkWork("GNU",array1,n);
-    }
-    g_tot /= (double) (num_trials - 1);
-    
-    
-    for (i = 0; i < num_trials; i++) {
-        fill(argv[2],array1,n);
-        start = TIME();
-        QS(array1,n);
-        end   = TIME();
-        if (i) {
-            m_tot += end - start;
-        }    
-        checkWork("schein",array1,n);
-    
-    }
-    m_tot /= (double) (num_trials - 1);
-    
-        
-    
-    fprintf(stdout,"%10ld\t%5.10f\t%5.10f\t%2.2f\n",n,m_tot,g_tot,
-            100*((g_tot/m_tot) - 1));
-    free (array1);
-    return 0; 
-}
-#endif
-
-
-
-
-

File hsort/t/.back/s1.c~

-
-#define TY signed char
-#define TY_FMT "%c"
-#include "../ufunc/s1_qsort.c"
-#define QS s1_qsort
-#include "qsort-cmp.c"

File hsort/t/.back/s2.c~

-
-#define TY short
-#define TY_FMT "%i"
-#include "../ufunc/s2_qsort.c"
-#define QS s2_qsort
-#include "qsort-cmp.c"

File hsort/t/.back/s4.c~

-#define TY long
-#define TY_FMT "%ld"
-#include "../ufunc/s4_qsort.c"
-#define QS s4_qsort
-#include "qsort-cmp.c"

File hsort/t/.back/s8.c~

-#define TY long long
-#define TY_FMT "%lld"
-#include "../ufunc/s8_qsort.c"
-#define QS s8_qsort
-#include "qsort-cmp.c"

File hsort/t/.back/u1.c~

-
-#define TY unsigned char
-#define TY_FMT "%d"
-#include "../ufunc/u1_qsort.c"
-#define QS u1_qsort
-#include "qsort-cmp.c"
-
-

File hsort/t/.back/u2.c~

-
-#define TY unsigned short
-#define TY_FMT "%ui"
-#include "../ufunc/u2_qsort.c"
-#define QS u2_qsort
-#include "qsort-cmp.c"

File hsort/t/.back/u4.c~

-#define TY unsigned int
-#define TY_FMT "%u"
-#include "../ufunc/u4_qsort.c"
-#define QS u4_qsort
-#include "qsort-cmp.c"
-

File hsort/t/.back/u8.c~

-#define TY unsigned long long
-#define TY_FMT "%llu"
-#include "../ufunc/u8_qsort.c"
-#define QS u8_qsort
-#include "qsort-cmp.c"

File hsort/ufunc/.back/f4_hsort.c~

-/* the <= and == tests for floats are extremely slow for certain distributions of numbers
-exhibited in the test harness.  So we turn off sections of the sorting alg that use this
-with QSORT_SKIP_EQUALITY */
-
-#ifndef F4_QSORT
-#define F4_QSORT
-#define QSORT_TY float
-#define QS_(name) f4_q## name
-
-#include "../qsort.c"
-#endif

File hsort/ufunc/.back/f8_hsort.c~

-#ifndef F8_QSORT
-#define F8_QSORT
-#define QSORT_TY double
-#define QS_(name) f8_q## name
-#include "../qsort.c"
-#endif

File hsort/ufunc/.back/s1_hsort.c~

-#ifndef S1_QSORT
-#define S1_QSORT
-#define QSORT_TY signed char
-#define QS_(name) s1_q## name
-#include "qsort.c"
-#endif

File hsort/ufunc/.back/s2_hsort.c~

-#ifndef S2_QSORT
-#define S2_QSORT
-#define QSORT_TY signed short
-#define QS_(name) s2_q## name
-#include "qsort.c"
-#endif

File hsort/ufunc/.back/s4_qsort.c~

-#ifndef S4_QSORT
-#define S4_QSORT
-#define QSORT_TY int
-#define QS_(name) s4_q## name
-#include "../qsort.c"
-#endif

File hsort/ufunc/.back/s8_hsort.c~

-#ifndef S8_QSORT
-#define S8_QSORT
-#define QSORT_TY long long
-#define QS_(name) s8_q## name
-#include "../qsort.c"
-#endif

File hsort/ufunc/.back/u1_hsort.c~

-#ifndef U1_QSORT
-#define U1_QSORT
-#define QS_(name) u1_q## name
-#define QSORT_TY unsigned char
-#include "qsort.c"
-#endif

File hsort/ufunc/.back/u2_hsort.c~

-#ifndef U2_QSORT
-#define U2_QSORT
-#define QSORT_TY unsigned short
-#define QS_(name) u2_q## name
-#include "qsort.c"
-#endif

File hsort/ufunc/.back/u4_hsort.c~

-#ifndef U4_QSORT
-#define U4_QSORT
-#define QSORT_TY uint32_t
-#define QS_(name) u4_q##name
-#include "../qsort.c"
-#endif
-
-

File hsort/ufunc/.back/u8_hsort.c~

-#ifndef U8_QSORT
-#define U8_QSORT
-#define QSORT_TY unsigned long long
-#define QS_(name) u8_q## name
-#include "../qsort.c"
-#endif

File qsort/ufunc/.back/f4_qsort.c~

-/* the <= and == tests for floats are extremely slow for certain distributions of numbers
-exhibited in the test harness.  So we turn off sections of the sorting alg that use this
-with QSORT_SKIP_EQUALITY */
-
-#ifndef F4_SORT
-#define F4_SORT
-#define QSORT_TY float
-#define QS_(name) f4_q## name
-
-#include "qsort.c"
-#endif

File qsort/ufunc/.back/f4_sort.c~

-#ifndef F4_SORT
-#define F4_SORT
-#define QSORT_TY float
-#define QS_(name) f4_## name
-
-#include "qsort.c"
-#endif

File qsort/ufunc/.back/f8_qsort.c~

-#ifndef F8_QSORT
-#define F8_QSORT
-#define QSORT_TY double
-#define QS_(name) f8_q## name
-#include "qsort.c"
-#endif

File qsort/ufunc/.back/s1_qsort.c~

-#ifndef S1_SORT
-#define S1_SORT
-#define QSORT_TY signed char
-#define QS_(name) s1_q## name
-#include "qsort.c"
-#endif

File qsort/ufunc/.back/s1_sort.c~

-#ifndef S1_SORT
-#define S1_SORT
-#define QSORT_TY signed char
-#define QS_(name) s1_## name
-#include "qsort.c"
-#endif

File qsort/ufunc/.back/s2_qsort.c~

-#ifndef S2_SORT
-#define S2_SORT
-#define QSORT_TY signed short
-#define QS_(name) s2_q## name
-#include "qsort.c"
-#endif

File qsort/ufunc/.back/s4_qsort.c~

-#ifndef S4_SORT
-#define S4_SORT
-#define QSORT_TY long
-#define QS_(name) s4_q## name
-#include "qsort.c"
-#endif

File qsort/ufunc/.back/s4_sort.c~

-#ifndef S4_SORT
-#define S4_SORT
-#define QSORT_TY unsigned long
-#define QS_(name) s4_## name
-#include "qsort.c"
-#endif

File qsort/ufunc/.back/s8_qsort.c~

-#ifndef S8_SORT
-#define S8_SORT
-#define QSORT_TY long long
-#define QS_(name) s8_q## name
-#include "qsort.c"
-#endif

File qsort/ufunc/.back/u1_qsort.c~

-#ifndef U1_SORT
-#define U1_SORT
-#define QS_(name) u1_q## name
-#define QSORT_TY unsigned char
-#include "qsort.c"
-#endif

File qsort/ufunc/.back/u2_qsort.c~

-#ifndef U2_SORT
-#define U2_SORT
-#define QSORT_TY unsigned short
-#define QS_(name) u2_q## name
-#include "qsort.c"
-#endif

File qsort/ufunc/.back/u4_qsort.c~

-#ifndef U4_SORT
-#define U4_SORT
-#define QSORT_TY uint32_t
-#define QS_(name) u4_q## name
-#include "qsort.c"
-#endif

File qsort/ufunc/.back/u8_qsort.c~

-#ifndef U8_QSORT
-#define U8_QSORT
-#define QSORT_TY unsigned long long
-#define QS_(name) u8_q## name
-#include "qsort.c"
-#endif

File usort/.back/Makefile~

-test :
-	gcc -E -c -I../ -I../../ -I../qsort/ test.c
-
-clean :
-	rm -f test

File usort/.back/s1_sort.c~

-/* c 2008 Andrew I. Schein */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-#include <string.h>
-#include <assert.h>
-#include "s1_sort.h"
-#define S1_HIST_SIZE 256
-#define S1_HIST_MIN  -128
-#define S1_HIST_MAX  127
-
-#include "isort/ufunc/s1_isort.c"
-
-/* implements in place u1 bucket sort. */
-
-S1_SORT_LKG void s1_sort(char *a, const long sz) {
-    long j;
-    long n;
-    char *writer=a; 
-    long b0[S1_HIST_SIZE];
-    if (sz < 32) { return s1_isort(a,sz);}
-    memset(b0,0,S1_HIST_SIZE * sizeof(long));
-    for (n=0; n < sz; n++) {
-        b0[(unsigned char)a[n]]++; 
-    }
-    
-    for (j = S1_HIST_MIN; j <= S1_HIST_MAX; j++) { 
-        while (b0[(unsigned char)j]-- > 0) { 
-            *writer = j; 
-            writer++; 
-        }
-    }
-}
-
-#undef REFRESH
-#undef S1_HIST_SIZE

File usort/.back/s2_sort.c~

-/* c 2008 Andrew I. Schein */
-
-/* reference:
- *
- * http://www.stereopsis.com/radix.html
- * (was possibly buggy wrt to prefetching)
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-#include <string.h>
-#include <assert.h>
-#include "s2_sort.h"
-
-#include "isort/ufunc/s2_isort.c"
-
-#define _0(v) (unsigned) ((v)         & 0xFF)
-#define _1(v) (unsigned) (( ((v) >> 8)  & 0xFF) ^ 0x80)
-#define HIST_SIZE 256
-
-
-/* implements in place u4 radix sort. */
-
-S2_SORT_LKG void s2_sort(signed short *a, const long sz) {
-    long j;
-    unsigned pos;
-    long n, sum0=0 , sum1=0 , tsum=0;
-    signed short *reader, *writer, *buf;
-    long *b0, *b1;
-    if (sz < 32) { return s2_isort(a,sz);}
-    buf  = (signed short*) malloc(sz * sizeof(signed short));
-    b0   = calloc(HIST_SIZE * 2, sizeof(long));
-    b1   = b0 + HIST_SIZE;
-    
-    for (n=0; n < sz; n++) {
-        b0[_0(a[n])]++; 
-        b1[_1(a[n])]++; 
-    }
-    for (j = 0; j < HIST_SIZE; j++) { 
-        tsum  = b0[j] + sum0;
-        b0[j] = sum0 - 1;
-        sum0  = tsum;
-        
-        tsum  = b1[j] + sum1;
-        b1[j] = sum1 - 1;
-        sum1  = tsum;
-    }   
-    writer = buf;
-    reader = a;
-    for (n=0; n < sz; n++) {
-        pos = _0(reader[n]);
-        writer[++b0[pos]] = reader[n];
-    }
-    writer = a;
-    reader = buf;
-    for (n=0; n < sz; n++) {
-        pos = _1(reader[n]); 
-        writer[++b1[pos]] = reader[n];
-    }
-    free(buf);  
-    free(b0);
-}
-
-#undef REFRESH
-#undef _0
-#undef _1
-#undef _2
-#undef HIST_SIZE

File usort/.back/u1_sort.c~

-/* c 2008 Andrew I. Schein */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-#include <string.h>
-#include <assert.h>
-#include "u1_sort.h"
-#define U1_HIST_SIZE 256
-#include "isort/ufunc/u1_isort.c"
-
-/* implements in place u1 bucket sort. */
-
-U1_SORT_LKG void u1_sort(unsigned char *a, const long sz) {
-    long j;
-    long n;
-    unsigned char *writer=a; 
-    long b0[U1_HIST_SIZE];
-    if (sz < 32) { return u1_isort(a,sz);}
-    memset(b0,0,U1_HIST_SIZE * sizeof(long));
-    for (n=0; n < sz; n++) {
-        b0[a[n]]++; 
-    }
-    
-    for (j = 0; j < U1_HIST_SIZE; j++) { 
-        while (b0[j]-- > 0) { 
-            *writer = j; 
-            writer++; 
-        }
-    }
-}
-
-#undef REFRESH
-#undef U1_HIST_SIZE

File usort/.back/u2_sort.c~

-/* c 2008 Andrew I. Schein */
-
-/* reference:
- *
- * http://www.stereopsis.com/radix.html
- * (was possibly buggy wrt to prefetching)
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-#include <string.h>
-#include <assert.h>
-#include "u2_sort.h"
-
-#include "isort/ufunc/u2_isort.c"
-
-#define _0(v) ((v)         & 0xFF)
-#define _1(v) (((v) >> 8)  & 0xFF)
-#define HIST_SIZE 256
-
-/* implements in place u4 radix sort. */
-
-U2_SORT_LKG void u2_sort(unsigned short *a, const long sz) {
-    long j;
-    unsigned pos;
-    long n, sum0=0 , sum1=0 , tsum=0;
-    unsigned short *reader, *writer, *buf;
-    long *b0, *b1;
-    if (sz < 32) { return u2_isort(a,sz);}
-    buf = (unsigned short*) malloc(sz * sizeof(unsigned short));
-    b0   = calloc(HIST_SIZE * 2, sizeof(long));
-    b1   = b0 + HIST_SIZE;
-    
-    for (n=0; n < sz; n++) {
-        b0[_0(a[n])]++; 
-        b1[_1(a[n])]++; 
-    }
-    for (j = 0; j < HIST_SIZE; j++) { 
-        tsum  = b0[j] + sum0;
-        b0[j] = sum0 - 1;
-        sum0  = tsum;
-        
-        tsum  = b1[j] + sum1;
-        b1[j] = sum1 - 1;
-        sum1  = tsum;
-    }   
-    writer = buf;
-    reader = a;
-    for (n=0; n < sz; n++) {
-        pos = _0(reader[n]);
-        writer[++b0[pos]] = reader[n];
-    }
-    writer = a;
-    reader = buf;
-    for (n=0; n < sz; n++) {
-        pos = _1(reader[n]); 
-        writer[++b1[pos]] = reader[n];
-    }
-    free(buf);  
-    free(b0);
-}
-
-#undef REFRESH
-#undef _0
-#undef _1
-#undef _2
-#undef HIST_SIZE

File usort/t/.back/Makefile~

-include ../defs.mk
-
-APPS=u1 u2 u4 s4 u8 s1 s2 s8 f4 f8
-SRC=$(patsubst %,%.c,$(wildcard $(APPS)))
-
-all : $(APPS)
-	echo $(SRC)
-
-u1  : ctype-cmp.c  $(SRC)  
-	$(CC) $(G) $(W) $(I) $(O)  -o u1 u1.c 
-
-s1  : ctype-cmp.c  $(SRC)  
-	$(CC) $(G) $(W) $(I) $(O)  -o s1 s1.c 
-
-s2  : ctype-cmp.c  $(SRC)  
-	$(CC) $(G) $(W) $(I) $(O)  -o s2 s2.c 
-
-u4  : ctype-cmp.c  $(SRC)  
-	$(CC) $(G) $(W) $(I) $(O) -o u4 u4.c 
-
-s4  : ctype-cmp.c  $(SRC)  
-	$(CC) $(G) $(W) $(I) $(O)  -o s4 s4.c 
-
-u2  : ctype-cmp.c  $(SRC)  
-	$(CC) $(G) $(W) $(I) $(O) -o u2 u2.c 
-
-u8  : ctype-cmp.c  $(SRC)  
-	$(CC) $(G) $(W) $(I) $(O) -o u8 u8.c 
-
-s8  : ctype-cmp.c  $(SRC)  
-	$(CC) $(G) $(W) $(I) $(O) -o s8 s8.c 
-
-f4  : ctype-cmp.c $(SRC)
-	$(CC) $(G) $(W) $(I) $(O) -o f4  f4.c
-
-f8  : clean ctype-cmp.c $(SRC)
-	$(CC) $(G) $(W) $(I) $(O) -o f8  f8.c
-
-
-clean :
-	rm -f $(APPS)