summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjonsykkel <jonrevold@gmail.com>2020-04-08 11:18:18 +0200
committerjonsykkel <jonrevold@gmail.com>2020-04-08 11:18:18 +0200
commitbecba8a6ce4f06849d507a87006d1f2dad5bc741 (patch)
tree594e1864db5f34f6f4f18aaeb65b6afe2e12313b
parent6f8e8f5bf55f9e755b27e50c02107b86d3eb1f7f (diff)
downloadct_sequence-becba8a6ce4f06849d507a87006d1f2dad5bc741.tar.gz
start vork
-rw-r--r--src/a3.c53
1 files changed, 40 insertions, 13 deletions
diff --git a/src/a3.c b/src/a3.c
index 0c36fdd..265b0de 100644
--- a/src/a3.c
+++ b/src/a3.c
@@ -17,24 +17,33 @@ algo_t a3 = {
#define M24_SIZE 3
#define M24_RANGE (1<<(M24_SIZE*8))
+#define M32_SIZE 4
+
#define CROSSOVER (1<<15)
#define CROSSOVER_MASK (~(CROSSOVER-1))
-static uint8_t *m24;
-static uint32_t *m32;
+//static uint8_t *m24;
+//static uint8_t *m32;
+static uint8_t *m;
+static uint8_t *m_32ik; //TMP
static size_t m24_n;
static size_t m32_n;
+static size_t m32_off;
static void inner (uint32_t x);
static void inner_bias(uint32_t x);
void a3_init(uint64_t n){
- t = 0;
- m24_n = n > CROSSOVER ? CROSSOVER : n;
- m32_n = n-m24_n;
- m24 = calloc(sizeof(uint8_t)*M24_SIZE*m24_n,1);
- m32 = calloc(sizeof(uint32_t)*m32_n,1);
- if(!m24 || !m32) fuk("memory\n");
+ size_t size;
+ t = 0;
+ m24_n = n > CROSSOVER ? CROSSOVER : n;
+ m32_n = n-m24_n;
+ size = sizeof(uint8_t)*M24_SIZE*m24_n;
+ m32_off = size;
+ size += sizeof(uint8_t)*M32_SIZE*m32_n;
+ m = calloc(size,1);
+ m_32ik = m+m32_off;
+ if(!m) fuk("memory\n");
}
void a3_loop(uint64_t x0,uint64_t x1){
@@ -59,14 +68,23 @@ static void inner(uint32_t x){
//if(t >= CROSSOVER){
if(t & CROSSOVER_MASK){
+ /*
uint64_t i = t-m24_n;
r = m32[i];
m32[i] = x;
+ */
+
+ uint8_t *p;
+
+ r = 0;
+ p = m_32ik+(t*M32_SIZE);
+ memcpy(&r,p,M32_SIZE);
+ memcpy(p,&x,M32_SIZE);
}else{
uint8_t *p;
r = 0;
- p = m24+(t*M24_SIZE);
+ p = m+(t*M24_SIZE);
memcpy(&r,p,M24_SIZE);
memcpy(p,&x,M24_SIZE);
}
@@ -78,18 +96,27 @@ static void inner_bias(uint32_t x){
//if(t >= CROSSOVER){
if(t & CROSSOVER_MASK){
- uint64_t i = t-m24_n;
- r = m32[i];
- m32[i] = x;
+ uint8_t *p;
+
+ r = 0;
+ p = m_32ik+(t*M32_SIZE);
+ memcpy(&r,p,M32_SIZE);
+ memcpy(p,&x,M32_SIZE);
t = r == 0 ? 0 : x-r;
}else{
uint8_t *p;
r = 0;
- p = m24+(t*M24_SIZE);
+ p = m+(t*M24_SIZE);
memcpy(&r,p,M24_SIZE);
memcpy(p,&x,M24_SIZE);
t = (x-r) & 0x00FFFFFF;
}
+
+ return;
+ uint32_t c24;
+
+ c24 = ((int32_t)t-CROSSOVER)>>31; //FFFFetc.. if t < CROSSOVER
+
}