Home
  • About
  • All posts

A Guide to Bits and Bytes - Mon, Jan 22, 2024

My take on bit masking, bit manipulation, and boolean algegra (WIP)

Preface

Welcome to the world of bitwise operations, where we don’t just count sheep to fall asleep – we shift them left and right! If you’ve ever wondered what your computer is up to while you’re swiping left or right on your favorite app, you’re about to dive into the nitty-gritty of it. Bitwise operations are like the secret handshakes of the digital world; they’re how computers whisper sweet nothings to each other in the language of 0s and 1s. So, buckle up and put on your thinking cap – or should I say, your ‘bit’-ing cap? – as we embark on a journey through the land of ANDs, ORs, NOTs, and XORs. Who said bits and bytes couldn’t be fun?

Bits and Bytes and Words Oh My

At the heart of every computer lies a maze of transistors, akin to tiny switches that govern the flow of electricity. These transistors operate on a simple principle: they’re either in an ‘on’ state or an ‘off’ state, echoing the binary language of ones and zeros. This binary foundation underpins all computing operations, starting at the most fundamental level with bits.

Bits   2^n   Max Value (2^n - 1)   
121
243
387
41615
53231
66463
7128127
8256255
9512511
1010241023
1120482047
1240964095
1381928191
141638416383
153276832767
166553665535

Back to Home


© Matt Williams 2024

Twitter Linkedin GitHub GitLab