if-else 逻辑简化

if-else logic simplification

我有两个寄存器如下,

HL(consecutive), H holds 8-bit, L holds 8-bit so HL is 16-bit register pair
DE(consecutive), D holds 8-bit, E holds 8-bit so DE is 16-bit register pair

我无法像 if(HL > DE) 那样直接比较 HLDE。相反,我必须将寄存器单独比较为 H, L, D, E。我构造 if-else 结构的可能性知道 if(HL > DE).

1.

if (l < e)
   if(h > d)
      do what I want
... if not checking other possibilities 2, 3

2.

if (l > e)
   if(h > d)
      do what I want
... if not checking other possibilities 1, 3

3.

if (h > d)
     do what I want
... if not checking other possibilities 1, 2

我不确定我做的对不对。但是,如果是这样,可以简化其中的三个吗?

有两种情况unsigned hl > de:

  1. h > d
  2. h == d AND l > e