// implementation is largely adapted from Numerical Recipes for C. The
// input data (and reference data) should be generated using the
// qsort_gendata.pl perl script and dumped to a file named
-// dataset1.h The smips-gcc toolchain does not support system calls
-// so printf's can only be used on a host system, not on the smips
-// processor simulator itself. You should not change anything except
-// the HOST_DEBUG and PREALLOCATE macros for your timing run.
+// dataset1.h.
#include "util.h"
#include <string.h>
for (;;)
{
-#if HOST_DEBUG
- printArray( "", n, arr );
-#endif
-
// Insertion sort when subarray small enough.
if ( ir-l < INSERTION_THRESHOLD )
{
// Push pointers to larger subarray on stack,
// process smaller subarray immediately.
-#if HOST_DEBUG
- assert(stackp < stack+NSTACK);
-#endif
-
if ( ir-i+1 >= j-l )
{
stackp[0] = ir;
int main( int argc, char* argv[] )
{
- // Output the input array
- printArray( "input", DATA_SIZE, input_data );
- printArray( "verify", DATA_SIZE, verify_data );
-
#if PREALLOCATE
// If needed we preallocate everything in the caches
sort(DATA_SIZE, verify_data);
sort( DATA_SIZE, input_data );
setStats(0);
- // Print out the results
- printArray( "test", DATA_SIZE, input_data );
-
// Check the results
return verify( DATA_SIZE, input_data, verify_data );
}