DEV Community

Bitwise Operations on your Fingers πŸ™ŒπŸ‘©πŸ»β€πŸ’»

Emily Cain on November 29, 2018

I first came across bitwise operations as part of an Advent of Code challenge in 2017. I was thoroughly confused. "How can you do AND on two number...
Collapse
 
phlash profile image
Phil Ashby

Brilliant pictures! Fun fact - using four fingers (a 4 bit nibble) as you have gives you a representation of one hexadecimal digit on each hand, so you can easily translate between the commonly written form (hex) and hands. Wanna evaluate (0xff431023 XOR 0x6742a7b2)? Work through the hex nibbles one pair at a time!

it's nibbles all the way down.... ;)

Collapse
 
equiman profile image
Camilo Martinez • Edited

It all make sense now

🀘AND 🀟 = 🀘
1001 AND 1001 = 1001
9 AND 9 = 9

See it upside-down andyou will get: 666. It's a secret invocation πŸ‘Ή

With great power comes great responsability. Use only when need fix bugs in production.

Collapse
 
rebeccacaroline profile image
Rebecca Holzschuh

Thank you for writing and publishing this! This is super helpful

Collapse
 
trueneu profile image
Pavel Gurkov

Next thing to do would be to learn how to shift to the right a two’s complement using fingers.

Collapse
 
elmuerte profile image
Michiel Hendriks

Nice :) And this scales up to the total number of people around you. (Granted they still have all their fingers.)