Algorithm 逻辑简化

Algorithm 逻辑简化,algorithm,if-statement,logic,boolean-logic,Algorithm,If Statement,Logic,Boolean Logic,我有两个寄存器,如下所示 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 我不能像ifHL>DE那样直接比较HL和DE。相反,我必须分别比较寄存器H、L、D、E。我构造if-else结构来了解ifHL>DE 一, 三, 我不确定我是否做得对。

我有两个寄存器,如下所示

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
我不能像ifHL>DE那样直接比较HL和DE。相反,我必须分别比较寄存器H、L、D、E。我构造if-else结构来了解ifHL>DE

一,

三,


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

当未签名的hl>de时,有两种情况:

h>d h==d,l>e
签名还是未签名?@YvesDaoust未签名,我łya Bursov的回答。h>d或h=d和l>e@YvesDaoust是的,先生,它就像一个符咒,但我想知道它们是如何被简化的。你能说吗?你的建议太复杂了。它很有魅力,但我不知道用什么方法来简化它们。你能说吗?@snr我不确定我是否理解这个问题,你是什么意思?我是说你是如何得到简化的?你用什么方法?我想是吧
if (l < e)
   if(h > d)
      do what I want
... if not checking other possibilities 2, 3
if (l > e)
   if(h > d)
      do what I want
... if not checking other possibilities 1, 3
if (h > d)
     do what I want
... if not checking other possibilities 1, 2