#include #include #if PRINT_INTERMEDIATES uint32_t rawWC = 0; #endif #if TIME_SECTIONS #include clock_t start, end; double section_time; char * curr_section; #define START_TIME(section_name) do {\ curr_section = section_name;\ fprintf(stderr, "BEGIN %s\n", curr_section);\ start = clock();\ } while (0); #define END_TIME do {\ end = clock();\ section_time = ((double) (end - start)) / CLOCKS_PER_SEC;\ fprintf(stderr, "END %s, %fs\n\n", curr_section, section_time);\ } while (0); #else // TIME_SECTIONS not specified, define to be nothing #define START_TIME(section_name) 0; #define END_TIME 0; #endif /* */ #define WORDS 12971u #define WORDLEN 5u #define CHARMASK ~0b1100000u #define A_BIT 0b10u #define Z_BIT (A_BIT << 26) #if PRINT_INTERMEDIATES #define PRINT2 printsigs(sigs, 2, i1, i2); #define PRINT3 printsigs(sigs, 3, i1, i2, i3); #define PRINT4 printsigs(sigs, 4, i1, i2, i3, i4); #else #define PRINT2 0; #define PRINT3 0; #define PRINT4 0; #endif /* */ typedef struct signature { char * word; uint32_t sign; } signature; /* */ signature* makeArray(FILE *, uint32_t*); uint32_t getsig(char*); int compare(const void*, const void*); uint32_t rmdups(signature*, uint32_t); void findWords(signature*, uint32_t); void printsigs(signature*, uint32_t, ...); void printDashed(uint32_t); /* */