69 lines
1.5 KiB
C
69 lines
1.5 KiB
C
#include <stdint.h>
|
|
|
|
#if TIME_SECTIONS
|
|
#include <time.h>
|
|
|
|
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
|
|
|
|
/* <defines> */
|
|
#define WORDS 12971
|
|
#define WORDLEN 5
|
|
#define CHARMASK ~0b1100000u
|
|
|
|
#define A_BIT 0b10
|
|
#define B_BIT 0b100
|
|
#define C_BIT 0b1000
|
|
#define D_BIT 0b10000
|
|
|
|
|
|
#if PRINT_INTERMEDIATES
|
|
#define PRINT2\
|
|
printf("%s, %s\n", sigs[i1].word, sigs[i2].word);
|
|
|
|
#define PRINT3\
|
|
printf("%s, %s, %s\n", sigs[i1].word, sigs[i2].word, sigs[i3].word);
|
|
|
|
#define PRINT4\
|
|
printf("%s, %s, %s, %s\n", sigs[i1].word, sigs[i2].word, sigs[i3].word, sigs[i4].word);
|
|
#else
|
|
#define PRINT2 0;
|
|
#define PRINT3 0;
|
|
#define PRINT4 0;
|
|
#endif
|
|
/* </defines> */
|
|
|
|
typedef struct signature {
|
|
char * word;
|
|
uint32_t sign;
|
|
} signature;
|
|
|
|
/* <declarations> */
|
|
int compare(const void*, const void*);
|
|
|
|
uint32_t getsig(char*);
|
|
|
|
void findWords(signature*, uint32_t);
|
|
signature* rmdups(signature*);
|
|
/* </declarations> */
|