Project

General

Profile

« Previous | Next » 

Revision ec513fa9

Added by Stilez y over 9 years ago

Redundant logic tests in a range check

The logic here is redundant. It tests IP1<START || IP2<START || IP1>END || IP2>END. Then it tests if IP1<IP2 unsigned.

If the latter test succeeds (ie test that first) then IP1>=START must imply IP2>=START and IP2<=END must imply IP1<=END. In other words we only need to test:

START <= IP1 <= IP2 <= END, ie 3 logic tests (IP1<=IP2 && IP1>=START && IP2<=END) not 5 logic tests.

  • added
  • modified
  • copied
  • renamed
  • deleted