A quick lesson on: What is IMP?
#3
(05-02-2022, 12:35 AM)SMcNeill Wrote: One way to break down the logic of IMP is to remember with A IMP B:

Your result is *always* going to have all the bits of B set…

For example, let’s assume A and B are both _UNSIGNED _BYTEs.

Now if B =3, the result of A IMP B will be = ??????11, depending on A to fill in the ?
And if B = 5, the result of A IMP B will be = ?????1?1, depending on A to fill in the ?

*Whatever* the final result is, it’s going to have every bit set that B already has set.




And, with that half of the process solved, it’s *also* going to set any bits that A *DOES NOT* have set.

A = 2.  B = 3.

In binary, those are:
A = 00000010
B = 00000011

A IMP B is solved by first setting all the bits in the answer to match B:   ??????11
Then we toggle all the bits in A: 11111101.
And we set the ones that are on, for our answer: 11111111

2 IMP 3 = 255




(NOT A) OR B

That’s the breakdown of what IMP is doing.

(NOT A) says the result is going to have all the bits set that A does NOT have.
OR B says our result is *also* going to have all the bits set that B does.

A IMP B = (NOT A) OR B

Really, that’s all there is to it.  It’s convoluted, and not really something I think most folks ever really need, but that’s all the does in a nutshell.
Then I don't get it! If ANY combinations will give 255, what's the point of it, and how could it be used (if I wanted to)? Can you show a (simple) example?
Reply


Messages In This Thread
A quick lesson on: What is IMP? - by SMcNeill - 05-02-2022, 12:35 AM
RE: A quick lesson on: What is IMP? - by PhilOfPerth - 05-09-2022, 01:39 AM
RE: A quick lesson on: What is IMP? - by SMcNeill - 05-09-2022, 02:54 AM
RE: A quick lesson on: What is IMP? - by Dimster - 07-27-2022, 01:42 PM
RE: A quick lesson on: What is IMP? - by SMcNeill - 07-27-2022, 02:32 PM
RE: A quick lesson on: What is IMP? - by Dimster - 07-27-2022, 05:22 PM
RE: A quick lesson on: What is IMP? - by SMcNeill - 07-27-2022, 07:03 PM
RE: A quick lesson on: What is IMP? - by SMcNeill - 07-27-2022, 07:27 PM
RE: A quick lesson on: What is IMP? - by Pete - 07-27-2022, 07:37 PM
RE: A quick lesson on: What is IMP? - by SMcNeill - 07-27-2022, 07:59 PM
RE: A quick lesson on: What is IMP? - by Pete - 07-27-2022, 10:14 PM
RE: A quick lesson on: What is IMP? - by Dimster - 07-28-2022, 12:51 PM
RE: A quick lesson on: What is IMP? - by SMcNeill - 07-28-2022, 04:34 PM
RE: A quick lesson on: What is IMP? - by Dimster - 07-28-2022, 04:53 PM
RE: A quick lesson on: What is IMP? - by JRace - 07-28-2022, 05:38 PM
RE: A quick lesson on: What is IMP? - by JRace - 11-05-2022, 03:50 AM
RE: A quick lesson on: What is IMP? - by vince - 11-10-2022, 06:56 AM



Users browsing this thread: 1 Guest(s)