dotfiles/.bin/OLD/bitshift

16 lines
402 B
Plaintext
Raw Normal View History

2023-02-22 08:31:38 +01:00
#!/bin/cat
+-----+-----+-----+-----+-----+
| x | y | x&y | x|y | x^y |
+-----+-----+-----+-----+-----+
| 0 | 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 | 1 |
| 1 | 0 | 0 | 1 | 1 |
| 1 | 1 | 1 | 1 | 0 |
+-----+-----+-----+-----+-----+
x&y = 1 when: both need to be 1
x|y = 1 when: one or both needs to be 1
x^y = 1 when: x and y are different