Follow-up thread: I screwed up the truth table in my tweet thread (OR instead of XOR) and corrected it at the end. This got me thinking though ... what are *all* of the truth tables for two single-bit inputs? Are there bitwise versions of them all?https://twitter.com/colmmacc/status/1101588472190517249 …
-
-
Next is the first one where things get a little weird. I've never had to use this one. a|b|c 0|0|0 0|1|0 1|0|1 1|1|0 code: a & (~b)
Show this thread -
Now another easy one: a|b|c 0|0|0 0|1|0 1|0|1 1|1|1 code: = a
Show this thread -
O.k another weird one I've never used: a|b|c 0|0|0 0|1|1 1|0|0 1|1|0 code: (~a) & b
Show this thread -
another simple one: a|b|c 0|0|0 0|1|1 1|0|0 1|1|1 code: = b
Show this thread -
time for XOR, the one I screwed up: a|b|c 0|0|0 0|1|1 1|0|1 1|1|0 code: a ^ b
Show this thread -
next comes OR: a|b|c 0|0|0 0|1|1 1|0|1 1|1|1 code: a | b
Show this thread -
NOR, common in electronics, rare in code: a|b|c 0|0|1 0|1|0 1|0|0 1|1|0 code: ~( a | b )
Show this thread -
Bitwise equality: a|b|c 0|0|1 0|1|0 1|0|0 1|1|1 code: ~(a^b)
Show this thread -
Deceptively simple: a|b|c 0|0|1 0|1|0 1|0|1 1|1|0 code: ~b
Show this thread -
This one is hard to even think of a use for: a|b|c 0|0|1 0|1|0 1|0|1 1|1|1 code: (~b) | (a & b)
Show this thread -
An inversion of an earlier simple one: a|b|c 0|0|1 0|1|1 1|0|0 1|1|0 code: ~a
Show this thread -
Another inversion, also probably useless: a|b|c 0|0|1 0|1|1 1|0|0 1|1|1 code: (~a) | (a & b)
Show this thread -
Last one! set all of the bits: a|b|c 0|0|1 0|1|1 1|0|1 1|1|1 code: = ~0
Show this thread -
That's all 16! If you think I need to number them, this thread wasn't for you ;-) just read the right most column as the number MSB to LSB top to bottom. Any good names for any of the un-named ones?
Show this thread
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.