Linux x64 Assembly Tutorial 6: Shifting Bits @WhatsACreel
Linux x64 Assembly Tutorial 6: Shifting Bits  @WhatsACreel
Uploaded June 2014 | Updated November 2026, 2 days ago
In this video we'll look at the shift instructions SHL, SHR and SAL. They're often used for fast multiplication and division of integers, but they also have many other uses.

SHL is shift left, it shifts the bits left and fills the vacant spots with 0. SHR is shift right, it shifts bits right and fills the vacant bits on the left with 0's. SAR is shift arithmetic right, it's the same SHR only it fills the vacant spots on the left with whatever the original sign bit was (the left most bit is the sign bit in a signed integer!).

SAR is supposed to be used for signed division of a register or memory by a power of 2, SHR is meant for unsigned division of integers by powers of 2.

At the end there's a challenge, you have to reverse, or mirror, the bits of an unsigned char. It's trickier than it sounds!
Linux x64 Assembly Tutorial 6: Shifting BitsAmendment to Vector vs ListLearn Python Programming 1: Installing Guide (Getting Started Guide)Learn Python Programming 3: If Statements (Conditions)C++ Tutorial 6: For LoopsC++ Tutorial 22: Multiple File ProjectsC++ Tutorial 7: FunctionsModern x64 Assembly 15: Introduction to SIMDC++ Tutorial for Beginners 1: Introduction and First ProgramShunting Yard Algorithm - Intro and Reverse Polish Notationx64 Assembly MultiThreading 3: Mutexes, SpinLocks and Critical SectionsReusing Headers and Source Code in C++
Creel |

Linux x64 Assembly Tutorial 6: Shifting Bits

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER