#include <stdio.h>
#include <stdlib.h>
#include "alexg.misc/avgmalloc.h"
#include "alexg.misc/avgtime.h"

#define ELMNTS 8
#define MODULO 100000
#define MODULO_UINT ((unsigned int) 0x7FFFFFFF)

#define WRITELINE2  if (DEBUG) { \
        printf("%6d(%2d %2d)Out:",n,THRESI16,TMERGEI);\
        for(i=0;i<ELMNTS;i++) printf("%d ",(int)ptr[i]); printf("..."); \
        for(i=n-ELMNTS;i<n;i++) printf("%d ",(int)ptr[i]); printf("\n");\
        }\
        printf("(%3d,%3d,%9d,%d,%d):",THRESI16,TMERGEI,n,type,runs);
#define CHECKLINE  for(i=0;i<n-1;i++) if (ptr[i]>ptr[i+1]) {printf("Not Sorted\n"); }
#define WRITELINE1   for(i=0;i<n;i++) ptr[i] = bptr[i];\
        fflush(stdout);\
        if (DEBUG) { \
        printf("%6d(%2d %2d)In :",n,THRESI16,TMERGEI);\
        for(i=0;i<ELMNTS;i++) printf("%d ",(int)ptr[i]); printf("..."); \
        for(i=n-ELMNTS;i<n;i++) printf("%d ",(int)ptr[i]); printf("\n");\
        }
#define WRITE1  elapsed=0.0; for(j=0;j<runs;j++){ for(i=0;i<n;i++) ptr[i] = bptr[i]; avg_tstart();
#define WRITE2  avg_tend(); elapsed += (avg_treturn()); }

