gpt4 book ai didi

algorithm - if-else 逻辑简化

转载 作者:塔克拉玛干 更新时间:2023-11-03 06:07:28 24 4
gpt4 key购买 nike

我有两个寄存器如下,

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

关于algorithm - if-else 逻辑简化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54948115/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com