HackerTrans
TopNewTrendsCommentsPastAskShowJobs

The Magic of Bits “Bitwise”(antonio-cooler.gitbook.io)

17 points·by CoolerVoid·4 lata temu·7 comments
antonio-cooler.gitbook.io
The Magic of Bits “Bitwise”

https://antonio-cooler.gitbook.io/coolervoid-tavern/the-magic-of-bits-bitwise

7 comments

parasti·4 lata temu
The target audience seems to be an intersection of people who are decently familiar with C and people who haven't been exposed to bitwise arithmetic.
m_antis89·4 lata temu
and, it doesn’t seem to be proofread.
efortis·4 lata temu
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-...
valbaca·4 lata temu
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...
tmountain·4 lata temu
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/
jhgb·4 lata temu
Reminded me of Thinking Forth (http://thinking-forth.sourceforge.net). Lookup tables FTW.
yababa_y·4 lata temu
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