summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjonsykkel <jonrevold@gmail.com>2020-04-05 02:20:53 +0200
committerjonsykkel <jonrevold@gmail.com>2020-04-05 02:20:53 +0200
commitde4bb42d54d733c9740e05a3eea48bfd0a31b06a (patch)
tree76f2ccee6762671d66167e11fe2d773e8298810c
parentb0d24f74e8c8a449236560d5fc47e6f80e11657d (diff)
downloadct_sequence-de4bb42d54d733c9740e05a3eea48bfd0a31b06a.tar.gz
Les retart
-rw-r--r--src/main.c38
1 files changed, 16 insertions, 22 deletions
diff --git a/src/main.c b/src/main.c
index 8035b84..51674c2 100644
--- a/src/main.c
+++ b/src/main.c
@@ -37,28 +37,21 @@ static void numper(void){
perse(100);
}
-static void numper_perse(void){
- uint64_t agurk;
- uint64_t outer;
- uint64_t last;
+static void numper_p(void){
+ uint64_t agurk;
+ uint64_t outer;
+ uint64_t last;
+ uint64_t x0;
+ uint64_t x1;
- t = 0;
agurk = n/100;
- outer = n/agurk+1;
- last = n%agurk;
- if(last == 0){
- last = agurk;
- outer--;
- }
-
- 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++;
-
- loop(beg,end);
- perse((y+1)*100/outer);
+ for(uint64_t y = 0;y < 100;y++){
+ x0 = y*agurk;
+ x1 = x0+agurk;
+ if(x1 > n) x1 = n;
+ if(y == 0) x0++;
+ loop(x0,x1);
+ perse(y+1);
}
}
@@ -70,15 +63,16 @@ int main(int argc,char **argv){
init = n3_init;
loop = n3_loop;
- nump = numper;
+ nump = numper_p;
n = strtoull(argv[1],0,10);
+ n = 100000000;
printf("n = %llu\n",n); fflush(stdout);
init(n);
ftimer_init(&ft);
nump();
- printf("result = %llu\n",t); fflush(stdout);
+ printf("t = %llu\n",t); fflush(stdout);
return 0;
}