summaryrefslogtreecommitdiffstats
path: root/src/a3.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/a3.c')
-rw-r--r--src/a3.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/a3.c b/src/a3.c
index 1cfe7c1..cd5d879 100644
--- a/src/a3.c
+++ b/src/a3.c
@@ -120,8 +120,9 @@ static void inner_bias(uint32_t x){
uint32_t m_sel;
uint32_t m_size;
uint32_t m_off;
- uint32_t r_zero;
- uint32_t t_mask;
+ uint32_t tmask;
+ uint32_t rnzero;
+ uint32_t rxdiff;
m_sel = ((int32_t)t-CROSSOVER)>>31; //FFFFetc.. if t < CROSSOVER
m_size = (m_sel & M24_SIZE) | (~m_sel & M32_SIZE);
@@ -131,11 +132,16 @@ static void inner_bias(uint32_t x){
r = 0;
//TODO: get rid of memcpy
- memcpy(r,p,m_size);
+ memcpy(&r,p,m_size);
memcpy(p,&x,m_size);
- t_mask = 0x00FFFFFF | ~m_sel;
- r_zero = ((int32_t)r-1)>>31;
+ tmask = 0x00FFFFFF | ~m_sel;
+ rnzero = (-(int32_t)r)>>31; //FFFFetc.. if r != 0
+ rxdiff = x-r;
+ rxdiff &= tmask;
+ rxdiff &= m_sel | rnzero; //clear rxdiff if t >= CROSSOVER and r == 0
+ t = rxdiff;
+