summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjonsykkel <jonrevold@gmail.com>2020-04-05 02:38:35 +0200
committerjonsykkel <jonrevold@gmail.com>2020-04-05 02:38:35 +0200
commitf4ba91887cd954276bd1b7a0dfaf253cb03db926 (patch)
tree0a741f2e1f3e6692bc6c2457488aa07a4c845a96
parent61d1ffd0230358d3abc2bd2bd58a36d298967e99 (diff)
downloadct_sequence-f4ba91887cd954276bd1b7a0dfaf253cb03db926.tar.gz
vork2
-rw-r--r--src/n1.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/n1.c b/src/n1.c
new file mode 100644
index 0000000..00c8d36
--- /dev/null
+++ b/src/n1.c
@@ -0,0 +1,27 @@
+#include "def.h"
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define BITS 36
+
+static uint32_t *h;
+
+void n1_init(uint64_t n){
+ size_t size;
+
+ size = sizeof(uint32_t)*n;
+ h = malloc(size);
+ if(!h) fuk("memory");
+ memset(h,0x00,size);
+}
+
+void n1_loop(uint64_t x0,uint64_t x1){
+ for(uint64_t x = x0;x < x1;x++){
+ uint64_t z;
+ z = h[t];
+ h[t] = x;
+ t = z == 0 ? 0 : x-z;
+ }
+}
+