summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjonsykkel <jonrevold@gmail.com>2020-04-04 23:57:22 +0200
committerjonsykkel <jonrevold@gmail.com>2020-04-04 23:57:22 +0200
commit438212632bebdb7be8a501fd68dd6fa0f195004d (patch)
treeac7bfb1afd61e25467ddecbe10fe33f6502e84fe
parent6e6979791071ab9022512dadac143387c8711680 (diff)
downloadct_sequence-438212632bebdb7be8a501fd68dd6fa0f195004d.tar.gz
a
-rw-r--r--makefile2
-rw-r--r--src/main.c35
2 files changed, 22 insertions, 15 deletions
diff --git a/makefile b/makefile
index e95eed8..ead176d 100644
--- a/makefile
+++ b/makefile
@@ -56,7 +56,7 @@ ifneq ($(run),)
run_cmd := @echo "run $(bin)"
run_cmd += && cd bin
run_cmd += && echo "----------------------------------------------------------------"
- run_cmd += && time ./$(out_file) 100000000
+ run_cmd += && time ./$(out_file) 5000000000
run_cmd += ; echo "----------------------------------------------------------------"
run_cmd += && cd ..
endif
diff --git a/src/main.c b/src/main.c
index 3d013ca..9fef679 100644
--- a/src/main.c
+++ b/src/main.c
@@ -7,10 +7,9 @@
#define U32_MAX ((1ULL<<32)-1)
#define I32_MAX ((1ULL<<31)-1)
-#define BITS 34
+#define BITS 36
static ftimer_t ft;
-static bstream_t bs;
static uint8_t *h;
static void fuk(char const *str){
@@ -32,24 +31,32 @@ static void perse(int p){
static void init(uint64_t n){
size_t size;
- size = sizeof(uint8_t)*n*BITS/8;
+ size = sizeof(uint8_t)*n*BITS>>3;
h = malloc(size);
if(!h) fuk("memory");
memset(h,0x00,size);
-
- bstream_open(&bs,h,0,size*8);
}
-static uint64_t load_store(uint64_t t,uint64_t in){
+static uint64_t load_store(uint64_t t,uint64_t i){
uint64_t r;
-
- bstream_seek(&bs,t*BITS);
- bstream_read64(&bs,&r,BITS);
- bstream_seek(&bs,t*BITS);
- bstream_write64(&bs,in,BITS);
-
- //r = h[t];
- //h[t] = in;
+ uint8_t *p;
+
+ r = 0;
+ p = h+(t*BITS>>3);
+ memcpy(&r,p,5);
+ if(t & 1){
+ r >>= 4;
+ }else{
+ r &= 0x0000000FFFFFFFFF;
+ }
+
+ if(t & 1){
+ i <<= 4;
+ i |= p[0] & 0x0F;
+ }else{
+ i |= (uint64_t)(p[4] & 0xF0)<<32;
+ }
+ memcpy(p,&i,5);
return r;
}