Bit Shifting, Bit Masking, and Bit Manipulation @ChristopherLum
Bit Shifting, Bit Masking, and Bit Manipulation  @ChristopherLum
Uploaded May 2025 | Updated November 2026, 2 hours ago
In this video we discuss various bitwise operations such as left shift, right shift, OR, AND, XOR, NOT, etc. During this discussion we also examine the nuances between an arithmetic shift and a logical shift. We use these basic operations to develop various functions that allow us to directly manipulate bits stored in memory. This is useful for many applications where it is necessary to check or change specific bits in a variable.

Topics and timestamps:
0:00 – AND, OR, XOR, NOT
2:05 – Left shift
10:37 – Right shift
18:23 – MATLAB example
23:24 – BitMask
26:54 – BitSetTo1
30:02 – BitSetTo0
33:13 – BitSetToValue
34:15 – BitFlip
35:57 – IsBit1
39:30 – IsBit0
41:03 – MATLAB and C implementations

Lecture notes and code can be downloaded from github.com/clum/YouTube/tree/main/ComputerScience01

MATLAB Implementation - github.com/clum/MatlabLum
C Implementation - github.com/clum/LumCSDK

All computer science videos in a single playlist youtube.com/playlist?list=PLxdnSsBqCrrGJMznbasDmaTZoIkT1KX9R

#ComputerScience

All electronics videos in a single playlist youtube.com/playlist?list=PLxdnSsBqCrrHPTdlAN36pRAO5Yh8HcR-v

#Electronics

You can support this channel via Patreon at patreon.com/christopherwlum or by clicking on the ‘Thanks’ button underneath the video. Thank you for your help!
Bit Shifting, Bit Masking, and Bit ManipulationMATLAB CopilotObtaining and Using the MatlabLum RepositoryTune an Antenna Using a NanoVNAFourier SeriesUmm...is the ferry supposed to look like that?AE501 Week04How to Install DJI Fly on iOS and AndroidPotential Functions, Fundamental Theorem of Calculus Applied to Line Integrals, & Path IndependenceProbability Distribution Functions and Cumulative Distribution FunctionsInterpolation in MATLAB Using scatteredInterpolantTreadmill Motor Spins But Belt Does Not Move – Solved!
Christopher Lum |

Bit Shifting, Bit Masking, and Bit Manipulation

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER