summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjonsykkel <jonrevold@gmail.com>2020-04-02 21:18:15 +0200
committerjonsykkel <jonrevold@gmail.com>2020-04-02 21:18:15 +0200
commit45fc6d309612988b4c930e47a27bfe36e77a9731 (patch)
tree6ee28c5ac3f03c651ec7321e6bc580ffdb4d4006
parent196b3d947d2747652977a1d26d14f8361ce13e1a (diff)
downloadct_sequence-45fc6d309612988b4c930e47a27bfe36e77a9731.tar.gz
vork
-rw-r--r--src/main.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/main.c b/src/main.c
index 433ec72..baa71fb 100644
--- a/src/main.c
+++ b/src/main.c
@@ -4,33 +4,39 @@
#include <string.h>
//#define MAX 100000000
-#define MAX 1000000000
+#define MAX 5000000000
-static void primt(uint32_t x,uint32_t t){
- printf("[%3d] %d\n",x+1,t);
+static void primt(uint64_t x,uint64_t t){
+ printf("%lld: %lld\n",x+1,t);
}
int main(int argc,char **argv){
- uint32_t *h;
- uint32_t t;
- uint32_t n;
+ uint64_t *h;
+ uint64_t t;
- h = malloc(sizeof(uint32_t)*MAX);
+ //h = malloc(sizeof(uint32_t)*MAX);
+ h = calloc(sizeof(uint64_t)*MAX,1);
if(!h) return 1;
- memset(h,0xFF,sizeof(uint32_t)*MAX);
+ //memset(h,0xFF,sizeof(uint32_t)*MAX);
t = 0;
- n = 0;
- for(uint32_t x = 0;x < MAX;x++){
- t = n;
+ for(uint64_t x = 1;x < MAX;x++){
+ /*
if((int32_t)h[t] >= 0){
n = x-h[t];
}else{
n = 0;
}
- h[t] = x;
- //primt(x,t);
+ */
+
+ uint64_t z;
+ uint64_t ht;
+
+ ht = h[t];
+ z = (int64_t)ht>>63;
+ h[t] = -x;
+ t = z & (x+ht);
}
primt(MAX-1,t);