Skip to main content


How to use Bitwise Operators

In this video, Ming Tung Wong talks about Bitwise Operators and how they differ from Logical Operators. Afterwards he demonstrates some interesting ways that they can be commonly used. One of those demonstrations involve Brian Kernighan’s Algorithm for counting bits. Ming explains what is happening behind the scenes of the algorithm as well as its efficiency and then concludes with a simple benchmark of three different bit counting algorithms.

Below is the code used for the demonstrations:

Bit Counting Visual -
Bit Counting Benchmarks -

Project Members: Ming Tung Wong