Understanding Bitshift Operations

A short and beginner-friendly course on bitshift operations and how they are used in game programming

4.90 (260 reviews)
Udemy
platform
English
language
Game Development
category
instructor
7,003
students
1 hour
content
Apr 2021
last update
FREE
regular price

What you will learn

How bitshifting is used in game programming

The math behind shift left and shift right

The difference between arithmetic and logical shifts

Description

This is a short course that covers the fundamental ideas behind bitshifting, bitshift operators, and where it is used in the context of game programming.

This is a beginner-friendly course that has no real pre-requisites. We will start from the basics, analyzing the mathematics of how numbers work, and translate what we learn from the decimal system to the binary system.

We will analyze the real applications of bitshifting, understand why the math works, and review a couple of examples of source code that use bitshifting.

The course covers:

  • The math behind multiplication and division by the base in the decimal system

  • The math behind multiplication and division by the base in binary

  • The difference between left shift and right shift

  • Bitshift operators as processor instructions

  • Bitshift operators in high-level languages

  • Arithmetic and logical shifts

  • Examples of source code applications

· Review of relevance and applications of bitshifting operations in software development

Bitshifting was very popular in early games. We will also discuss their current relevance and when we should consider using them in modern code.

There are no hardware or programming language requirements for this course. If you program in any high-level language (C, C++, Java, Python, Rust, etc) you will be able to follow along and understand how bitshifting works. But if you want to follow along and check the example source code, you'll need a basic code editor and a compiler.

Content

Introduction

Introduction and Motivations

Multiplication and Division in Decimal and Binary

Multiplication and Division in Base 10
Multiplication and Division in Base 2

Bitshift In Context

Bitshifting in the Processor
Examples of Code
Arithmetic and Logical Shifts

Conclusion

Applications and Relevance of Bitshifing
Modern Compiler Optimization

Bonus Lecture

Discount on Our Other Courses

Screenshots

Understanding Bitshift Operations - Screenshot_01Understanding Bitshift Operations - Screenshot_02Understanding Bitshift Operations - Screenshot_03Understanding Bitshift Operations - Screenshot_04

Reviews

Danilo
July 30, 2023
Adorei o curso, de o Gustavo é o melhor professor desta plataforma, além de dominar completamente o conteúdo tem uma didática incrível. Fiz o outro curso dele "Programming games for the Atari 2600 platform using 6502 Assembly Language". Tem outros quatro crusos que desejo fazer e que estão na plataforma dele, estou juntando dinheiro para tentar comprar outro curso ainda neste anos. Muito obrigado professor.
Bryan
April 18, 2023
I love learning from Gustavo because he makes more complex ideas like this so much more understandable. This was a great byte-sized lecture to cover the purpose and use of shifting. I loved the VGA example with the decomposition of 320.
Mhd
January 6, 2023
Excellent. Now I have a deeper understanding of bitwise shift operators and what they're actually used for!
Jeffrey
August 29, 2022
As always, all of Gustavo's courses are excellent -- clear examples and great explanations. I cannot recommend his courses enough.
Mohammed
June 13, 2022
Great course on bit shift and the difference between arithmetic and logical bit shifting. Along with discussion on performance gains, compiler optimization and the applications of bit shifts in real codebases. 100% Recommended.
Pablo
April 23, 2022
As always, Gustavo is the best teacher that you could possible find in the world, he explain ,so well and so insightful ,things that it encourage you to continue learning.
Panagiotis
March 22, 2022
Excellent course as usual!! Many thanks Gustavo. Just want to point on thing on base2 multiplication. Its works only until we have no reached the first 1 on MSB side. After that, when the 1 lost during the left shift, we have no longer a multiplication. p.e. when we apply a logical shift left on 10101000 (168 on dec), ended to 01010000 (80 on dec). So the question here is how we can check this and prevent it for happening? Speaking of course when we have 8-bit numbers.
Diego
October 26, 2021
Really good course. I've already taken four courses from Gustavo and he is an amazing teacher. I hope I can buy 3D course one of these days.
Jorge
October 7, 2021
Muy bueno. Gustavo domina la materia y explica muy sencillo las cosas. Es el segundo curso suyo que hago y estoy muy contento con lo que he aprendido.
Mark
August 25, 2021
Now I finally have a better understanding of how and why to use bit shifting. I've encountered it a handful of times, and it's always felt intimidating and occult, so it's nice to pull back the veil. Hopefully now I won't be so flummoxed when instructors casually shift like it's something we should all just know. Anyway, Gustavo is an excellent instructor who really seems passionate about teaching and making principles as clear as possible to his students. Thanks a ton for this free lesson, Gustavo!
Karim
July 19, 2021
sure it have apowerful knowledge I should have to understand RGB bit shift operations while developing a game librarary
Josvan
January 10, 2021
Totally liked this course, first time here in Udemy that I got really engaged with it. The instructor is very nice and clear! I'm totally buying courses of Gustavo
Svetoslav
November 18, 2020
Course content is a very good from games development view point, but can be extended to be more general. I already recommended this course to some my colleagues. I mean that title is more general then content - all other things a great. Very nice visual presentation. One more lecture something as "How to set, clear, and toggle a bit" - will be perfect /Number: 10/. It was end of week, my fault - no bad feelings.
Andrea
November 9, 2020
Clear, easy to understand explanations of the theory. But the "Examples of code" lecture was a disappointment. Just seeing a collection of all bitshift operations extracted from a program doesn't teach me anything. It would have been interesting to see what they were really used for in the program. I would like to see examples of where bitshift operations could still be useful for.
Alex
October 22, 2020
It gave me a new vision of the numbers, but sometimes the teacher is too mouth-watering. Regardless, it looks useful, I haven't finished it yet.

Charts

Price

Understanding Bitshift Operations - Price chart

Rating

Understanding Bitshift Operations - Ratings chart

Enrollment distribution

Understanding Bitshift Operations - Distribution chart
2364002
udemy ID
5/12/2019
course created date
5/18/2019
course indexed date
Bot
course submited by