DEV Community

Discussion on: Bitwise Operations in C/C++

Collapse
 
noah11012 profile image
Noah11012

If you're writing code in higher level languages like JS or Python then the need for bitwise operations do not present themselves very often. Two examples requiring the use of bitwise operations are in these videos by Danial Shiffman:

youtube.com/watch?v=MlRlgbrAVOs
youtube.com/watch?v=meGcdIoTYgw

Some uses I can think for the shifting operators are:

  1. To create a bitmask
  2. One of the operations to convert the endianness of some multi-bit value
  3. If you shift a value by 2 then it's a shortcut for multiplication or division by two depending on shift operator used.

Daniel Shiffman goes into more detail in this other video of his:

youtube.com/watch?v=oCBlwsY8sR4