Skip to content

Commit

Permalink
re-ordered XOR before AND in DMA bounds check
Browse files Browse the repository at this point in the history
A sample micro-optimization that saves one instruction.
  • Loading branch information
Iconoclast committed Aug 7, 2019
1 parent 2ea5951 commit 3e30349
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions su.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/******************************************************************************\
* Project: MSP Simulation Layer for Scalar Unit Operations *
* Authors: Iconoclast *
* Release: 2018.12.18 *
* Release: 2019.08.06 *
* License: CC0 Public Domain Dedication *
* *
* To the extent possible under law, the author(s) have dedicated all copyright *
Expand Down Expand Up @@ -243,7 +243,7 @@ void SP_DMA_READ(void)
} while (i < length);
} while (count);

if ((*CR[0x0] & 0x1000) ^ (offC & 0x1000))
if ((*CR[0x0] ^ offC) & 0x1000)
message("DMA over the DMEM-to-IMEM gap.");
GET_RCP_REG(SP_DMA_BUSY_REG) = 0x00000000;
GET_RCP_REG(SP_STATUS_REG) &= ~SP_STATUS_DMA_BUSY;
Expand Down Expand Up @@ -281,7 +281,7 @@ void SP_DMA_WRITE(void)
} while (i < length);
} while (count);

if ((*CR[0x0] & 0x1000) ^ (offC & 0x1000))
if ((*CR[0x0] ^ offC) & 0x1000)
message("DMA over the DMEM-to-IMEM gap.");
GET_RCP_REG(SP_DMA_BUSY_REG) = 0x00000000;
GET_RCP_REG(SP_STATUS_REG) &= ~SP_STATUS_DMA_BUSY;
Expand Down

0 comments on commit 3e30349

Please sign in to comment.