Hmmm. It's quite frustrating. I remember from electronics at university that there are XAND-circuits. But I can't remember what they did.... I'll check it out.
Hmmm. It's quite frustrating. I remember from electronics at university that there are XAND-circuits. But I can't remember what they did.... I'll check it out.
I understand that there is no defined XAND but what im trying to do is some thing like this
00000011 AND
00000101
-----------
00000001 ~
-----------
11111110
= XAND
here is the XAND Truth table
input a | input b| output
0 0 1
1 0 0
0 1 0
1 1 1
Is getting a truth table like that in C?
thanks
That's the NXOR function I think.
So where's the hard part? Just combine an & and a ~.I understand that there is no defined XAND but what im trying to do is some thing like this
00000011 AND
00000101
-----------
00000001 ~
-----------
11111110
x ~= (a & b);
...or...
#define XAND(a,b) ~(a&b)
x = XAND(a,b);
Quzah.
Hope is the first step on the road to disappointment.
I was just makeing sure that it could be done and that my thought process on how to do it was right.
THanks
This is how a XAND works: If only one of the input bits is 0, then the output is high.
It's the opponent of the XOR: If only one of the input bits is 1, then the output is high.
Note that for 2 input bits, the XAND behaves like a XOR. But when having more than 2 input bits, you can see the differences.
This little program will illustrate this:
Code:#include <stdio.h> int main (void) { unsigned char a, b, c; unsigned char s; a = 0xFF; b = 0xB5; c = 0x9D; s = ~a ^ ~b ^ ~c; printf ("XAND (%02X, %02X, %02X) = %02X\n", a, b, c, s); return 0; }
Very helpful thread! Thanks for the added information.
Great explanation from Deckard!
</reincarnation>
Gee, over 2 years old and then you bump the thread!
Nice going
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.