
-----------------------------------
mirhagk
Sun Jan 02, 2011 10:41 pm

Get a truth table
-----------------------------------
I need an operation to solve this truth table, could be algabraic, or boolean (prefer boolean) and can be a combo

a and b are the inputs
x is the output
y is an overflow flag (for instance 1+1 means x=0 and y=1)


See the truth table below (basically I need no overflow, and x to be equal to b regardless of what's in a)
And no I can't just assign x to equal b (operation takes place in a byte, and individual assignment of bits is not possible in c++, well it probably is, but i'd prefer to not have to dive into assembly.
a b x y
0 0 0 0
0 1 1 0
1 0 0 0
1 1 1 0

-----------------------------------
wtd
Sun Jan 02, 2011 10:53 pm

RE:Get a truth table
-----------------------------------
Bit manipulation most certainly is possible in C++ without resorting to inline assembly.

-----------------------------------
DemonWasp
Tue Jan 04, 2011 12:26 am

RE:Get a truth table
-----------------------------------
Look up the bitwise operators: | , ^ , and & . That's bitwise-or, bitwise-xor and bitwise-and. Combined with >> and 