diff options
author | Yun-Ze Li <p76091292@gs.ncku.edu.tw> | 2021-12-23 09:17:06 +0100 |
---|---|---|
committer | Yun-Ze Li <p76091292@gs.ncku.edu.tw> | 2021-12-23 09:17:06 +0100 |
commit | eda4f83d73ab2737e7d0d245d87c1dd248a93ce5 (patch) | |
tree | 52d5931ecebfc1211ccdba0dd7c8c4639082f22b /BS | |
parent | 875271995b12c00b24f38124b2b19e3fc94d2057 (diff) |
bs_refactor: Remove redundant lines
This commit reduce redundant lines for calculating
`current_mram_block_addrA`.
Signed-off-by: Yun-Ze Li <p76091292@gs.ncku.edu.tw>
Diffstat (limited to 'BS')
-rw-r--r-- | BS/dpu/task.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/BS/dpu/task.c b/BS/dpu/task.c index ac4ca38..92a383f 100644 --- a/BS/dpu/task.c +++ b/BS/dpu/task.c @@ -92,11 +92,12 @@ int main_kernel1() { mram_read((__mram_ptr void const *) current_mram_block_addr_A, cache_aux_A, BLOCK_SIZE); mram_read((__mram_ptr void const *) (end_mram_block_addr_A - BLOCK_SIZE * sizeof(DTYPE)), cache_aux_B, BLOCK_SIZE); - current_mram_block_addr_A = (start_mram_block_addr_A + end_mram_block_addr_A) / 2; - current_mram_block_addr_A &= WORD_MASK; - while(1) { + // Locate the address of the mid mram block + current_mram_block_addr_A = (start_mram_block_addr_A + end_mram_block_addr_A) / 2; + current_mram_block_addr_A &= WORD_MASK; + // Boundary check if(current_mram_block_addr_A < (start_mram_block_addr_A + BLOCK_SIZE)) { @@ -148,16 +149,12 @@ int main_kernel1() { if(found == -2) { end_mram_block_addr_A = current_mram_block_addr_A; - current_mram_block_addr_A = (current_mram_block_addr_A + start_mram_block_addr_A) / 2; - current_mram_block_addr_A &= WORD_MASK; } // If found == -1, we need to discard left part of the input vector else if (found == -1) { start_mram_block_addr_A = current_mram_block_addr_A; - current_mram_block_addr_A = (current_mram_block_addr_A + end_mram_block_addr_A) / 2; - current_mram_block_addr_A &= WORD_MASK; } } } |