The Magic of Bits “Bitwise”(antonio-cooler.gitbook.io)
antonio-cooler.gitbook.io
The Magic of Bits “Bitwise”
https://antonio-cooler.gitbook.io/coolervoid-tavern/the-magic-of-bits-bitwise
7 コメント
In words, you can think of XOR as: True when both bits are different.
---
Although the post is an introduction, I wanted to share a nice tip for coding multiplexers with bitwise operations:
https://blog.uidrafter.com/bitwise-table-lookup
---
And here's a fun example, KITT-like lights, for practicing bitwise operations:
https://ericfortis.github.io/web-animations/#-kitt-like-ligh...
Source Code:
https://github.com/ericfortis/web-animations/blob/main/kitt-...
---
Although the post is an introduction, I wanted to share a nice tip for coding multiplexers with bitwise operations:
https://blog.uidrafter.com/bitwise-table-lookup
---
And here's a fun example, KITT-like lights, for practicing bitwise operations:
https://ericfortis.github.io/web-animations/#-kitt-like-ligh...
Source Code:
https://github.com/ericfortis/web-animations/blob/main/kitt-...
The book linked at the bottom is a treasure trove of bitwise fun:
"Hackers Delight" https://www.amazon.com/Hackers-Delight-2nd-Henry-Warren/dp/0...
"Hackers Delight" https://www.amazon.com/Hackers-Delight-2nd-Henry-Warren/dp/0...
One fun way to get familiar with bitwise operations is writing a virtual machine, as it involves a lot of masking and shifting bits from instructions to extract relevant pieces (dare I say bits) of information. If anyone is interested in going this route, I recommend LC-3, as it's very straightforward.
https://www.jmeiners.com/lc3-vm/
https://www.jmeiners.com/lc3-vm/
Reminded me of Thinking Forth (http://thinking-forth.sourceforge.net). Lookup tables FTW.
one of my pet peeves of common computers is that they don't have a generalized LUT2 instruction. why do you pick out a handful of specific bitwise ops for me when all 16 are lying in reach! a mere 4 bit look up table!
let ix = a | b<<1
(lut & (1 << ix)) >> ix