diff options
author | jonsykkel <jonrevold@gmail.com> | 2020-04-05 01:42:19 +0200 |
---|---|---|
committer | jonsykkel <jonrevold@gmail.com> | 2020-04-05 01:42:19 +0200 |
commit | d7aab7fb313d25b8a870ce3ca9c10d26859fd806 (patch) | |
tree | 602a9e5f0687ee30cac4612a3fcd4a3503501527 | |
parent | 438212632bebdb7be8a501fd68dd6fa0f195004d (diff) | |
download | ct_sequence-d7aab7fb313d25b8a870ce3ca9c10d26859fd806.tar.gz |
vork
-rw-r--r-- | makefile | 4 | ||||
-rw-r--r-- | src/main.c | 56 |
2 files changed, 36 insertions, 24 deletions
@@ -37,7 +37,7 @@ out := $(bin) ifeq ($(build),debug) CFLAGS += -g else ifeq ($(build),release) - CFLAGS += -O3 + CFLAGS += -Ofast -march=native -mtune=native -fomit-frame-pointer #CFLAGS += -Wunused-variable -Wunused-function -Wunused-parameter -Wunused-label LDFLAGS += $(RELFLAGS) else ifeq ($(build),analyze) @@ -56,7 +56,7 @@ ifneq ($(run),) run_cmd := @echo "run $(bin)" run_cmd += && cd bin run_cmd += && echo "----------------------------------------------------------------" - run_cmd += && time ./$(out_file) 5000000000 + run_cmd += && time ./$(out_file) 100000000 run_cmd += ; echo "----------------------------------------------------------------" run_cmd += && cd .. endif @@ -11,6 +11,11 @@ static ftimer_t ft; static uint8_t *h; +static uint64_t t; +static uint64_t n; +static uint64_t agurk; +static uint64_t outer; +static uint64_t last; static void fuk(char const *str){ printf("error!( %s\n",str); @@ -61,13 +66,35 @@ static uint64_t load_store(uint64_t t,uint64_t i){ return r; } -int main(int argc,char **argv){ - uint64_t t; - uint64_t n; - uint64_t agurk; - uint64_t outer; - uint64_t last; +static void numper(void){ + for(uint64_t x = 1;x < n;x++){ + uint64_t z; + + z = load_store(t,x); + t = z == 0 ? 0 : x-z; + } + perse(100); +} + +static void numper_perse(void){ + perse(0); + for(uint64_t y = 0;y < outer;y++){ + uint64_t beg = y*agurk; + uint64_t end = beg+(y == outer-1 ? last : agurk); + if(y == 0) beg++; + + for(uint64_t x = beg;x < end;x++){ + uint64_t z; + + z = load_store(t,x); + t = z == 0 ? 0 : x-z; + } + + perse((y+1)*100/outer); + } +} +int main(int argc,char **argv){ if(argc < 2){ printf("usake: numper <n>\n"); fflush(stdout); return 1; @@ -87,22 +114,7 @@ int main(int argc,char **argv){ } ftimer_init(&ft); - perse(0); - - for(uint64_t y = 0;y < outer;y++){ - uint64_t beg = y*agurk; - uint64_t end = beg+(y == outer-1 ? last : agurk); - if(y == 0) beg++; - - for(uint64_t x = beg;x < end;x++){ - uint64_t z; - - z = load_store(t,x); - t = z == 0 ? 0 : x-z; - } - - perse((y+1)*100/outer); - } + numper_perse(); printf("result = %llu\n",t); fflush(stdout); |