diff --git a/Makefile b/Makefile index 6d1a16b..7aac596 100644 --- a/Makefile +++ b/Makefile @@ -21,16 +21,17 @@ find_one ?= 0 fancy ?= 0 free ?= 0 -# note: setting deleted to 0 doesn't get any extra words, -# but does just about triple the execution time. -# I do not recommend setting it to false. -delete ?= 1 - CC := clang -MACROS := -DPRINT_INTERMEDIATES=$(printing) -DTIME_SECTIONS=$(timing) -DASSUME_SAFE=$(assume) -DFIND_ONE=$(find_one) -DDELETE=$(delete) -DFANCYPRINT=$(fancy) -DFREE=$(free) +ifdef asm +override asm = -S +else +override asm = +endif -FLAGS := -Ofast -Wall -Werror +MACROS := -DPRINT_INTERMEDIATES=$(printing) -DTIME_SECTIONS=$(timing) -DASSUME_SAFE=$(assume) -DFIND_ONE=$(find_one) -DFANCYPRINT=$(fancy) -DFREE=$(free) $(asm) + +FLAGS := -Wall -Werror -Ofast OUTPUT := -o bw bw: solvedle.o boilerplate.o @@ -52,9 +53,9 @@ run: bw wordleWords.txt .PHONY: fast fast: solvedle.c boilerplate.c - $(CC) $(FLAGS) -DPRINT_INTERMEDIATES=0 -DTIME_SECTIONS=0 -DASSUME_SAFE=1 -DFIND_ONE=1 -DDELETE=1 -DFANCYPRINT=0 -DFREE=0 -c $^ + $(CC) $(FLAGS) -DPRINT_INTERMEDIATES=0 -DTIME_SECTIONS=0 -DASSUME_SAFE=1 -DFIND_ONE=1 -DFANCYPRINT=0 -DFREE=0 -c $^ make bw .PHONY: clean clean: - rm *.o bw \ No newline at end of file + rm *.o *.s bw \ No newline at end of file diff --git a/boilerplate.c b/boilerplate.c index 63a1564..1498c83 100644 --- a/boilerplate.c +++ b/boilerplate.c @@ -48,7 +48,7 @@ signature* makeArray(FILE * f, uint32_t* arrlen) { uint32_t s = getsig(word); if (s != 0) { // no duplicate word letters in word - sigs[i].word = strndup(word, 5); + memcpy(sigs[i].word, word, 5); sigs[i].sign = s; i++; } diff --git a/boilerplate.h b/boilerplate.h index 9a6ef63..445e5d2 100644 --- a/boilerplate.h +++ b/boilerplate.h @@ -57,7 +57,7 @@ uint32_t rawWC = 0; /* */ typedef struct signature { - char * word; + char word[5]; uint32_t sign; } signature;