Template:LogicalTruthPlugin: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
{{FixedStart}} | {{FixedStart}} | ||
The results of the bitwise logical operations, where '''A''' and '''B''' are operands, | The results of the bitwise logical operations, where '''A''' and '''B''' are operands, | ||
and '''1''' or '''0''' indicate whether a bit is set or not set: | and '''1''' or '''0''' indicate whether a bit is set or not set: | ||
┌───────────┬────────────────────────────────────────────────────────┐ | ┌───────────┬────────────────────────────────────────────────────────┐ | ||
│ '''Operands''' │ '''Logical operations''' │ | │ '''Operands''' │ '''Logical operations''' │ | ||
├─────┬─────┼───────┬─────────┬────────┬─────────┬─────────┬─────────┤ | ├─────┬─────┼───────┬─────────┬────────┬─────────┬─────────┬─────────┤ | ||
│ '''A''' │ '''B''' │ [[NOT]] '''B''' │ '''A''' [[AND]] '''B''' │ '''A''' [[OR]] '''B''' │ '''A''' [[XOR]] '''B''' │ '''A''' [[EQV]] '''B''' │ '''A''' [[IMP]] '''B''' │ | │ '''A''' │ '''B''' │ [[NOT]] '''B''' │ '''A''' [[AND]] '''B''' │ '''A''' [[OR]] '''B''' │ '''A''' [[XOR]] '''B''' │ '''A''' [[EQV]] '''B''' │ '''A''' [[IMP]] '''B''' │ | ||
├─────┼─────┼───────┼─────────┼────────┼─────────┼─────────┼─────────┤ | ├─────┼─────┼───────┼─────────┼────────┼─────────┼─────────┼─────────┤ | ||
│ '''1''' │ '''1''' │ 0 │ 1 │ 1 │ 0 │ 1 │ 1 │ | │ '''1''' │ '''1''' │ 0 │ 1 │ 1 │ 0 │ 1 │ 1 │ | ||
├─────┼─────┼───────┼─────────┼────────┼─────────┼─────────┼─────────┤ | ├─────┼─────┼───────┼─────────┼────────┼─────────┼─────────┼─────────┤ | ||
│ '''1''' │ '''0''' │ 1 │ 0 │ 1 │ 1 │ 0 │ 0 │ | │ '''1''' │ '''0''' │ 1 │ 0 │ 1 │ 1 │ 0 │ 0 │ | ||
├─────┼─────┼───────┼─────────┼────────┼─────────┼─────────┼─────────┤ | ├─────┼─────┼───────┼─────────┼────────┼─────────┼─────────┼─────────┤ | ||
│ '''0''' │ '''1''' │ 0 │ 0 │ 1 │ 1 │ 0 │ 1 │ | │ '''0''' │ '''1''' │ 0 │ 0 │ 1 │ 1 │ 0 │ 1 │ | ||
├─────┼─────┼───────┼─────────┼────────┼─────────┼─────────┼─────────┤ | ├─────┼─────┼───────┼─────────┼────────┼─────────┼─────────┼─────────┤ | ||
│ '''0''' │ '''0''' │ 1 │ 0 │ 0 │ 0 │ 1 │ 1 │ | │ '''0''' │ '''0''' │ 1 │ 0 │ 0 │ 0 │ 1 │ 1 │ | ||
└─────┴─────┴───────┴─────────┴────────┴─────────┴─────────┴─────────┘ | └─────┴─────┴───────┴─────────┴────────┴─────────┴─────────┴─────────┘ | ||
[[Relational Operations]] return '''negative one''' (-1, all bits set) and '''zero''' | [[Relational Operations]] return '''negative one''' (-1, all bits set) and '''zero''' | ||
(0, no bits set) for '''true''' and '''false''', respectively. This allows relational | (0, no bits set) for '''true''' and '''false''', respectively. This allows relational | ||
tests to be inverted and combined using the bitwise logical operations. | tests to be inverted and combined using the bitwise logical operations. | ||
{{FixedEnd}} | {{FixedEnd}} |
Revision as of 22:18, 1 August 2022
The results of the bitwise logical operations, where A and B are operands, and 1 or 0 indicate whether a bit is set or not set: ┌───────────┬────────────────────────────────────────────────────────┐ │ Operands │ Logical operations │ ├─────┬─────┼───────┬─────────┬────────┬─────────┬─────────┬─────────┤ │ A │ B │ NOT B │ A AND B │ A OR B │ A XOR B │ A EQV B │ A IMP B │ ├─────┼─────┼───────┼─────────┼────────┼─────────┼─────────┼─────────┤ │ 1 │ 1 │ 0 │ 1 │ 1 │ 0 │ 1 │ 1 │ ├─────┼─────┼───────┼─────────┼────────┼─────────┼─────────┼─────────┤ │ 1 │ 0 │ 1 │ 0 │ 1 │ 1 │ 0 │ 0 │ ├─────┼─────┼───────┼─────────┼────────┼─────────┼─────────┼─────────┤ │ 0 │ 1 │ 0 │ 0 │ 1 │ 1 │ 0 │ 1 │ ├─────┼─────┼───────┼─────────┼────────┼─────────┼─────────┼─────────┤ │ 0 │ 0 │ 1 │ 0 │ 0 │ 0 │ 1 │ 1 │ └─────┴─────┴───────┴─────────┴────────┴─────────┴─────────┴─────────┘ Relational Operations return negative one (-1, all bits set) and zero (0, no bits set) for true and false, respectively. This allows relational tests to be inverted and combined using the bitwise logical operations. |