title
Intro to Binary and Bitwise Operators in C++
description
The first 1000 people to use the link will get a free trial of Skillshare Premium Membership: https://skl.sh/thecherno03211
Patreon ► https://patreon.com/thecherno
Instagram ► https://instagram.com/thecherno
Twitter ► https://twitter.com/thecherno
Discord ► https://thecherno.com/discord
Series Playlist ► https://thecherno.com/cpp
This video is sponsored by Skillshare.
detail
{'title': 'Intro to Binary and Bitwise Operators in C++', 'heatmap': [{'end': 638.452, 'start': 610.741, 'weight': 0.902}, {'end': 689.115, 'start': 675.31, 'weight': 0.916}, {'end': 899.044, 'start': 865.656, 'weight': 0.937}, {'end': 970.366, 'start': 930.351, 'weight': 0.718}, {'end': 1146.828, 'start': 1130.736, 'weight': 1}], 'summary': 'Covers various topics such as delaying c++ series, basics of bitwise operators, computer memory and binary representation, storing data in memory, understanding hexadecimal number system, and bitwise operators and bit shift, including real-world uses and a skillshare sponsorship offer for the first 1000 people.', 'chapters': [{'end': 35.806, 'segs': [{'end': 35.806, 'src': 'embed', 'start': 0.069, 'weight': 0, 'content': [{'end': 3.67, 'text': "Hey what's up guys, my name is Cherno, welcome back to my C++ series.", 'start': 0.069, 'duration': 3.601}, {'end': 6.051, 'text': "Yes, it is, it's still happening.", 'start': 4.01, 'duration': 2.041}, {'end': 9.072, 'text': 'I apologize for not making a video in the C++ series for a while.', 'start': 6.131, 'duration': 2.941}, {'end': 9.872, 'text': "it's just it's.", 'start': 9.072, 'duration': 0.8}, {'end': 15.834, 'text': "there's so much stuff going on in my life at the moment and it's it's a little bit insane to try and focus, but I'm doing it.", 'start': 9.872, 'duration': 5.962}, {'end': 18.535, 'text': "I'm here for you, I'm, we're gonna get through this, we're gonna.", 'start': 15.834, 'duration': 2.701}, {'end': 23.776, 'text': "there's a lot of stuff that we still need to cover in practically any series I've ever started on my channel.", 'start': 18.535, 'duration': 5.241}, {'end': 25.577, 'text': "so I'm, I'm gonna be here for a while.", 'start': 23.776, 'duration': 1.801}, {'end': 31.422, 'text': 'Now going back through the series and trying to decide where to continue was a bit of a challenge.', 'start': 25.717, 'duration': 5.705}, {'end': 35.806, 'text': 'But the way I see this, we kind of have two different things going on in this series.', 'start': 31.763, 'duration': 4.043}], 'summary': 'Cherno apologizes for delay in c++ series due to personal challenges, commits to continuing series.', 'duration': 35.737, 'max_score': 0.069, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KXwRt7og0gI/pics/KXwRt7og0gI69.jpg'}], 'start': 0.069, 'title': "Cherno's c++ series update", 'summary': 'Discusses the delay in c++ series videos due to personal reasons and the commitment to continue the series, highlighting the need to cover various topics and the challenge of deciding the next steps.', 'chapters': [{'end': 35.806, 'start': 0.069, 'title': "Cherno's c++ series update", 'summary': 'Discusses the delay in c++ series videos due to personal reasons and the commitment to continue the series, highlighting the need to cover various topics and the challenge of deciding the next steps.', 'duration': 35.737, 'highlights': ['Cherno acknowledges the delay in C++ series videos due to personal reasons and expresses commitment to continue, highlighting the need to cover various topics. (Relevance: 5)', 'Cherno mentions the challenge of deciding where to continue in the series, indicating the presence of two different aspects in the series. (Relevance: 4)']}], 'duration': 35.737, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KXwRt7og0gI/pics/KXwRt7og0gI69.jpg', 'highlights': ['Cherno acknowledges the delay in C++ series videos due to personal reasons and expresses commitment to continue, highlighting the need to cover various topics. (Relevance: 5)', 'Cherno mentions the challenge of deciding where to continue in the series, indicating the presence of two different aspects in the series. (Relevance: 4)']}, {'end': 355.629, 'segs': [{'end': 165.833, 'src': 'embed', 'start': 120.128, 'weight': 0, 'content': [{'end': 128.958, 'text': "rather than just working in a mathematical way that we're used to with our kind of base 10 decimal number system, they apply to binary.", 'start': 120.128, 'duration': 8.83}, {'end': 133.344, 'text': 'they apply to a base 2 number system that our computers are essentially made of.', 'start': 128.958, 'duration': 4.386}, {'end': 141.246, 'text': 'Now, when it comes to these bitwise operators, there are six main operators, and I would say probably four of them are ones that come up quite often.', 'start': 133.584, 'duration': 7.662}, {'end': 148.248, 'text': 'And those are the bit shift left and bit shift right operators, the bitwise AND and the bitwise OR operators,', 'start': 141.326, 'duration': 6.922}, {'end': 156.411, 'text': 'as well as the bitwise XOR or exclusive OR, and then the NOT operator, which is really just like inverting all of the bits.', 'start': 148.248, 'duration': 8.163}, {'end': 160.492, 'text': "I like to kind of think of it as like the invert operator, but yeah, it's called a NOT operator.", 'start': 156.611, 'duration': 3.881}, {'end': 165.833, 'text': 'way that all of these work and their actual real world uses that.', 'start': 160.752, 'duration': 5.081}], 'summary': 'Binary operations include 6 main operators, with 4 commonly used ones - bit shift left, bit shift right, bitwise and, and bitwise or.', 'duration': 45.705, 'max_score': 120.128, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KXwRt7og0gI/pics/KXwRt7og0gI120128.jpg'}, {'end': 268.866, 'src': 'embed', 'start': 238.717, 'weight': 1, 'content': [{'end': 241.538, 'text': 'They will just function as actual bitwise operators.', 'start': 238.717, 'duration': 2.821}, {'end': 245.8, 'text': 'You can overload them in your classes so that they do something else entirely.', 'start': 241.578, 'duration': 4.222}, {'end': 251.443, 'text': "That is possible, but I would think hard about that just to make sure that you're not confusing people.", 'start': 245.9, 'duration': 5.543}, {'end': 253.863, 'text': 'C++ library.', 'start': 252.903, 'duration': 0.96}, {'end': 258.244, 'text': 'So before we go on, I do wanna mention that this video is sponsored by Skillshare.', 'start': 254.183, 'duration': 4.061}, {'end': 260.105, 'text': 'And what is Skillshare? I hear you ask.', 'start': 258.344, 'duration': 1.761}, {'end': 268.866, 'text': 'Why Skillshare is an amazing online learning community where millions of creative and curious people from all around the world come together to learn various new skills.', 'start': 260.204, 'duration': 8.662}], 'summary': 'C++ bitwise operators can be overloaded in classes for different functionality. sponsored by skillshare.', 'duration': 30.149, 'max_score': 238.717, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KXwRt7og0gI/pics/KXwRt7og0gI238717.jpg'}, {'end': 340.004, 'src': 'embed', 'start': 279.749, 'weight': 3, 'content': [{'end': 288.692, 'text': 'bite-sized, very masterfully produced classes that are just on a wide variety of topics, including things like photography, videography, productivity,', 'start': 279.749, 'duration': 8.943}, {'end': 294.675, 'text': 'marketing, business strategy, drawing, illustration, like literally anything that you want to learn about.', 'start': 288.692, 'duration': 5.983}, {'end': 300.557, 'text': "you can just go to skillshare, type it in and you'll probably find a bunch of amazing classes on those specific topics.", 'start': 294.675, 'duration': 5.882}, {'end': 306.46, 'text': "I've been working with Skillshare for quite a while now and I do actually use the platform regularly to just you know,", 'start': 300.697, 'duration': 5.763}, {'end': 309.102, 'text': 'find classes on things that I might not know about.', 'start': 306.46, 'duration': 2.642}, {'end': 316.086, 'text': 'For me particularly, I use it for classes on creative topics, and I think that their art related classes are fantastic.', 'start': 309.142, 'duration': 6.944}, {'end': 320.99, 'text': "Coming in at just under $10 a month for an annual subscription, I think it's really amazing value.", 'start': 316.186, 'duration': 4.804}, {'end': 330.118, 'text': 'But Skillshare are also offering the first 1000 people who click the link in the description below a free trial of Skillshare premium so that you can explore your creativity.', 'start': 321.331, 'duration': 8.787}, {'end': 335.303, 'text': 'So definitely go ahead and check out Skillshare and a huge thank you as always to Skillshare for sponsoring this video.', 'start': 330.338, 'duration': 4.965}, {'end': 340.004, 'text': 'Now bitwise operators are kind of difficult to explain by waving my hands.', 'start': 335.543, 'duration': 4.461}], 'summary': 'Skillshare offers diverse, expert-led classes for under $10/month and a free trial for first 1000 people.', 'duration': 60.255, 'max_score': 279.749, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KXwRt7og0gI/pics/KXwRt7og0gI279749.jpg'}], 'start': 35.826, 'title': 'Bitwise operators in c++', 'summary': 'Covers the basics of six main bitwise operators in c++, their real-world uses, and the possibility of overloading or overriding these operators to work like functions. it also introduces a skillshare sponsorship with a free trial offer for the first 1000 people.', 'chapters': [{'end': 238.157, 'start': 35.826, 'title': 'Introduction to bitwise operators in c++', 'summary': 'Covers the basics of bitwise operators in c++, including the six main operators, their real-world uses, and the possibility of overloading or overriding these operators to work like functions, serving as an introductory to the topic in general.', 'duration': 202.331, 'highlights': ['The chapter introduces the basics of bitwise operators in C++, including the six main operators: bit shift left, bit shift right, bitwise AND, bitwise OR, bitwise XOR, and the NOT operator. This provides an overview of the primary bitwise operators in C++, laying the foundation for further understanding of their usage and implementation.', 'The possibility of overloading or overriding bitwise operators to work like functions is discussed, with an example of how the C++ library extensively utilizes this feature, such as in the case of cout using bit shift left operators for printing. Understanding the potential to treat bitwise operators as functions and the example of overloading them in the C++ library demonstrates the flexibility and extensibility of these operators.', 'The chapter highlights the relevance of bitwise operators in the context of binary and bit-level operations, emphasizing their application to the base 2 number system that computers are built upon. This emphasizes the fundamental role of bitwise operators in manipulating bits and their importance in working with binary data within computer systems.']}, {'end': 355.629, 'start': 238.717, 'title': 'C++ bitwise operators and skillshare sponsorship', 'summary': 'Discusses the use of c++ bitwise operators and introduces a sponsorship by skillshare, an online learning community offering a wide range of classes on various topics, with a special offer of a free trial for the first 1000 people who click the provided link.', 'duration': 116.912, 'highlights': ['The video is sponsored by Skillshare, an online learning community with millions of users and offers a variety of classes including photography, videography, productivity, marketing, and business strategy.', 'Skillshare is offering a free trial of Skillshare premium to the first 1000 people who click the link in the description below.', 'The platform offers classes at just under $10 a month for an annual subscription, providing great value for users.']}], 'duration': 319.803, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KXwRt7og0gI/pics/KXwRt7og0gI35826.jpg', 'highlights': ['The chapter introduces the basics of bitwise operators in C++, including the six main operators: bit shift left, bit shift right, bitwise AND, bitwise OR, bitwise XOR, and the NOT operator.', 'The possibility of overloading or overriding bitwise operators to work like functions is discussed, with an example of how the C++ library extensively utilizes this feature.', 'The chapter highlights the relevance of bitwise operators in the context of binary and bit-level operations, emphasizing their application to the base 2 number system that computers are built upon.', 'The video is sponsored by Skillshare, an online learning community with millions of users and offers a variety of classes including photography, videography, productivity, marketing, and business strategy.', 'Skillshare is offering a free trial of Skillshare premium to the first 1000 people who click the link in the description below.', 'The platform offers classes at just under $10 a month for an annual subscription, providing great value for users.']}, {'end': 535.677, 'segs': [{'end': 396.452, 'src': 'embed', 'start': 370.836, 'weight': 0, 'content': [{'end': 376.8, 'text': 'Well, without getting too deep into the hardware, essentially, inside our RAM we have a series of capacitors that have on and off states.', 'start': 370.836, 'duration': 5.964}, {'end': 381.603, 'text': 'So if we were to draw some kind of like electrical graph like this,', 'start': 377.1, 'duration': 4.503}, {'end': 389.648, 'text': 'we have a certain threshold where anything that falls below this we consider to be zero and anything above this threshold we consider to be one.', 'start': 381.603, 'duration': 8.045}, {'end': 396.452, 'text': 'So in other words, if we were to kind of convert this into this representation, then anything below this threshold would be zero.', 'start': 389.828, 'duration': 6.624}], 'summary': 'Ram contains capacitors with on/off states. threshold separates 0 and 1.', 'duration': 25.616, 'max_score': 370.836, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KXwRt7og0gI/pics/KXwRt7og0gI370836.jpg'}, {'end': 434.518, 'src': 'embed', 'start': 406.359, 'weight': 1, 'content': [{'end': 409.721, 'text': 'So this is basically how our RAM is capable of storing data.', 'start': 406.359, 'duration': 3.362}, {'end': 414.204, 'text': 'So, because we only have these two states, we just have one or zero.', 'start': 409.921, 'duration': 4.283}, {'end': 417.146, 'text': 'these are two states that we have on and off.', 'start': 414.204, 'duration': 2.942}, {'end': 424.911, 'text': "We can't really directly use our base 10 number system, which we call the decimal number system, because we, well, we have two states.", 'start': 417.486, 'duration': 7.425}, {'end': 427.914, 'text': "We don't have 10 states, which is what our number system uses.", 'start': 424.971, 'duration': 2.943}, {'end': 430.736, 'text': 'So every digit has 10 different representations.', 'start': 428.114, 'duration': 2.622}, {'end': 434.518, 'text': 'Zero through nine are our available numbers that we can use for each digit.', 'start': 430.836, 'duration': 3.682}], 'summary': 'Ram stores data using two states, 1 and 0. base 10 not used due to two states.', 'duration': 28.159, 'max_score': 406.359, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KXwRt7og0gI/pics/KXwRt7og0gI406359.jpg'}, {'end': 521.285, 'src': 'embed', 'start': 463.857, 'weight': 2, 'content': [{'end': 471.87, 'text': 'But to write out a simple table counting up to five zero would just be zero, one would be one, two would be one zero, three would be one one,', 'start': 463.857, 'duration': 8.013}, {'end': 475.014, 'text': 'four would be one zero zero and five would be one zero one.', 'start': 471.87, 'duration': 3.144}, {'end': 479.061, 'text': "So that's zero, one, two, three, four, and five in binary.", 'start': 475.235, 'duration': 3.826}, {'end': 484.384, 'text': 'By the way, if you ever want to see what a number is in binary or do various conversions and operations in various number systems,', 'start': 479.361, 'duration': 5.023}, {'end': 488.186, 'text': 'if you just open up the Windows calculator and go to this little menu over here,', 'start': 484.384, 'duration': 3.802}, {'end': 491.408, 'text': "there's a programmer view and that actually works with various number systems.", 'start': 488.186, 'duration': 3.222}, {'end': 498.912, 'text': 'So for example, I could switch to binary by just clicking on it, type in something like 101 and you can see that in decimal it is in fact five.', 'start': 491.448, 'duration': 7.464}, {'end': 502.954, 'text': "This can be very helpful, especially if, of course, you're dealing with larger numbers.", 'start': 499.052, 'duration': 3.902}, {'end': 509.558, 'text': "And in fact, there's also this cool little bit toggling keypad, which actually lets you turn certain bits on and off.", 'start': 503.254, 'duration': 6.304}, {'end': 513.461, 'text': 'So if you see something inside your memory representation and you just want to see what the number is,', 'start': 509.618, 'duration': 3.843}, {'end': 516.803, 'text': 'easily you can see the effect that it has on the number by toggling different bits.', 'start': 513.461, 'duration': 3.342}, {'end': 521.285, 'text': 'And if we fill in the zeros here, just so that they all line up, it looks a little nicer.', 'start': 517.023, 'duration': 4.262}], 'summary': 'The transcript explains binary counting and usage of windows calculator for conversions and operations.', 'duration': 57.428, 'max_score': 463.857, 'thumbnail': ''}], 'start': 355.649, 'title': 'Computer memory and binary representation', 'summary': "Covers computer memory storage using capacitors, ram's binary data storage, and practical examples of using binary in the windows calculator's programmer view, aiding in understanding number conversions and binary formatting.", 'chapters': [{'end': 406.098, 'start': 355.649, 'title': 'Memory storage in computers', 'summary': 'Explores how computers store numbers, explaining that the ram uses capacitors with on and off states to represent zeros and ones in memory.', 'duration': 50.449, 'highlights': ['The RAM uses capacitors with on and off states to represent zeros and ones in memory.', 'The graph representation shows that anything below a certain threshold is considered zero and anything above it is considered one.']}, {'end': 484.384, 'start': 406.359, 'title': 'Ram data storage', 'summary': 'Explains how ram stores data using a base two number system called binary, which only has two states (0 and 1) as opposed to the base 10 number system, providing examples of binary representation of numbers up to five.', 'duration': 78.025, 'highlights': ['RAM stores data using a base two number system called binary, which only has two states (0 and 1), as opposed to the base 10 number system, allowing for the representation of numbers through 0 and 1, and larger numbers through additional digits.', 'Binary representation examples are provided, such as 1 being one, 2 being one zero, 3 being one one, 4 being one zero zero, and 5 being one zero one, showcasing the application of the binary number system for counting up to five.']}, {'end': 535.677, 'start': 484.384, 'title': 'Windows calculator programmer view', 'summary': "Highlights how the windows calculator's programmer view can work with various number systems, such as binary, and demonstrates the practicality of using the bit toggling keypad to manipulate and visualize memory representations, ultimately aiding in the understanding of number conversions and binary formatting.", 'duration': 51.293, 'highlights': ["The Windows calculator's programmer view allows users to work with different number systems, such as binary, and easily convert numbers, like switching 101 from binary to decimal, which equals 5.", 'The bit toggling keypad in the Windows calculator enables users to manipulate and visualize memory representations by turning certain bits on and off, aiding in understanding the impact on the numbers and facilitating easier number conversions.', 'Understanding that zeros on the left-hand side in binary representations are for alignment and do not affect the actual value.']}], 'duration': 180.028, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KXwRt7og0gI/pics/KXwRt7og0gI355649.jpg', 'highlights': ['RAM uses capacitors with on and off states to represent zeros and ones in memory.', 'RAM stores data using a base two number system called binary, which only has two states (0 and 1).', "The Windows calculator's programmer view allows users to work with different number systems, such as binary, and easily convert numbers.", 'Binary representation examples are provided, showcasing the application of the binary number system for counting up to five.', 'The bit toggling keypad in the Windows calculator enables users to manipulate and visualize memory representations by turning certain bits on and off.']}, {'end': 696.078, 'segs': [{'end': 562.071, 'src': 'embed', 'start': 535.697, 'weight': 0, 'content': [{'end': 541.843, 'text': 'So what we know now is that to store the number five, we need to store these bits inside our memory.', 'start': 535.697, 'duration': 6.146}, {'end': 545.908, 'text': 'So what exactly does this statement tell us? Well, first of all, the data type is an int.', 'start': 541.964, 'duration': 3.944}, {'end': 548.551, 'text': 'And int is four bytes, at least on my compiler.', 'start': 546.368, 'duration': 2.183}, {'end': 553.218, 'text': "We're calling the variable a, this is just a way to essentially reference an area of our memory.", 'start': 548.651, 'duration': 4.567}, {'end': 555.742, 'text': "And then we're setting its value to five.", 'start': 553.699, 'duration': 2.043}, {'end': 562.071, 'text': "So four bytes is how much memory we'll actually allocate on the stack when we create this variable a.", 'start': 556.162, 'duration': 5.909}], 'summary': 'Storing the number 5 in memory as an int requires 4 bytes of memory allocation.', 'duration': 26.374, 'max_score': 535.697, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KXwRt7og0gI/pics/KXwRt7og0gI535697.jpg'}, {'end': 646.596, 'src': 'heatmap', 'start': 602.475, 'weight': 1, 'content': [{'end': 605.317, 'text': 'Now, your first question might be but why is this here??', 'start': 602.475, 'duration': 2.842}, {'end': 607.139, 'text': "Why isn't it over here??", 'start': 605.637, 'duration': 1.502}, {'end': 609.22, 'text': "Wouldn't it make more sense to put it over there??", 'start': 607.159, 'duration': 2.061}, {'end': 610.581, 'text': 'Why have you written this here??', 'start': 609.42, 'duration': 1.161}, {'end': 615.765, 'text': 'Now, the location of this actually depends on the endianness of your CPU.', 'start': 610.741, 'duration': 5.024}, {'end': 618.207, 'text': 'Most CPUs these days are little endian.', 'start': 616.025, 'duration': 2.182}, {'end': 623.268, 'text': 'meaning that the least significant bits would be over here on the left at a lower memory address.', 'start': 618.447, 'duration': 4.821}, {'end': 628.75, 'text': 'And the higher we go, the more the memory address grows, the more significant those bytes are.', 'start': 623.488, 'duration': 5.262}, {'end': 632.951, 'text': 'meaning like the numbers would be larger if there was a one here compared to a one there.', 'start': 628.75, 'duration': 4.201}, {'end': 638.452, 'text': 'Now, if we were compiling and running this code on a big Endian CPU, then this would actually be here.', 'start': 633.411, 'duration': 5.041}, {'end': 646.596, 'text': "Now, endianness doesn't refer to the actual order of the bits within the byte, just the order of the bytes themselves within, like you know,", 'start': 638.832, 'duration': 7.764}], 'summary': 'Endianness of cpu affects byte order in memory.', 'duration': 44.121, 'max_score': 602.475, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KXwRt7og0gI/pics/KXwRt7og0gI602475.jpg'}, {'end': 687.495, 'src': 'embed', 'start': 658.622, 'weight': 2, 'content': [{'end': 661.464, 'text': 'Anyway, we might have a dedicated video about endianness in the future.', 'start': 658.622, 'duration': 2.842}, {'end': 663.605, 'text': 'So, instead of me just writing this out for you,', 'start': 661.704, 'duration': 1.901}, {'end': 668.787, 'text': "let's actually try and write this code in C++ and run it through Visual Studio and actually see this memory.", 'start': 663.605, 'duration': 5.182}, {'end': 672.428, 'text': "So over here, I've just got this little program, which does the exact same thing that I wrote out.", 'start': 668.987, 'duration': 3.441}, {'end': 675.09, 'text': "So let's go ahead and run it with this breakpoint here.", 'start': 672.669, 'duration': 2.421}, {'end': 678.151, 'text': "So now we've actually got this variable A, it's been made, it's set to five.", 'start': 675.31, 'duration': 2.841}, {'end': 682.152, 'text': "Let's go ahead and go to Debug, Windows, and then Memory, and Memory 1.", 'start': 678.551, 'duration': 3.601}, {'end': 683.193, 'text': 'I mean, either of them will work.', 'start': 682.152, 'duration': 1.041}, {'end': 687.495, 'text': "What I'm interested in here is to actually look at the memory of this A variable.", 'start': 683.293, 'duration': 4.202}], 'summary': "Exploring endianness in c++ using visual studio's memory tool", 'duration': 28.873, 'max_score': 658.622, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KXwRt7og0gI/pics/KXwRt7og0gI658622.jpg'}, {'end': 706.601, 'src': 'heatmap', 'start': 675.31, 'weight': 0.916, 'content': [{'end': 678.151, 'text': "So now we've actually got this variable A, it's been made, it's set to five.", 'start': 675.31, 'duration': 2.841}, {'end': 682.152, 'text': "Let's go ahead and go to Debug, Windows, and then Memory, and Memory 1.", 'start': 678.551, 'duration': 3.601}, {'end': 683.193, 'text': 'I mean, either of them will work.', 'start': 682.152, 'duration': 1.041}, {'end': 687.495, 'text': "What I'm interested in here is to actually look at the memory of this A variable.", 'start': 683.293, 'duration': 4.202}, {'end': 689.115, 'text': "So over here, I'm just gonna type in &A.", 'start': 687.535, 'duration': 1.58}, {'end': 696.078, 'text': "hit enter and here you can actually see this memory and it's exactly what I wrote out.", 'start': 690.816, 'duration': 5.262}, {'end': 700.919, 'text': "We have this five over here and then each one of these is an additional byte that's just set to zero.", 'start': 696.198, 'duration': 4.721}, {'end': 706.601, 'text': "Now you might notice here that even though it says five, I mean there's like Fs and Bs and like what is going on here?", 'start': 701.16, 'duration': 5.441}], 'summary': 'Variable a set to 5, memory inspection reveals additional bytes set to zero.', 'duration': 31.291, 'max_score': 675.31, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KXwRt7og0gI/pics/KXwRt7og0gI675310.jpg'}], 'start': 535.697, 'title': 'Storing data in memory and endianness', 'summary': "Explains the storage of the 'int' data type in memory using 4 bytes and discusses cpu endianness with a demonstration in c++ and visual studio.", 'chapters': [{'end': 696.078, 'start': 535.697, 'title': 'Storing data in memory and endianness', 'summary': "Explains how the integer data type 'int' is stored in memory using 4 bytes, and discusses the concept of endianness in cpus, specifically little endian and big endian architectures, with a demonstration in c++ and visual studio.", 'duration': 160.381, 'highlights': ["The 'int' data type is stored in 4 bytes of memory, with leading zeros representing the full byte of memory. The 'int' data type is stored in 4 bytes of memory, with leading zeros representing the full byte of memory.", 'The concept of endianness in CPUs is discussed, distinguishing between little endian and big endian architectures. The chapter discusses the concept of endianness in CPUs, distinguishing between little endian and big endian architectures.', "A demonstration in C++ and Visual Studio is provided to showcase the actual memory representation of a variable using the 'Memory' feature. A demonstration in C++ and Visual Studio is provided to showcase the actual memory representation of a variable using the 'Memory' feature."]}], 'duration': 160.381, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KXwRt7og0gI/pics/KXwRt7og0gI535697.jpg', 'highlights': ["The 'int' data type is stored in 4 bytes of memory, with leading zeros representing the full byte of memory.", 'The concept of endianness in CPUs is discussed, distinguishing between little endian and big endian architectures.', "A demonstration in C++ and Visual Studio is provided to showcase the actual memory representation of a variable using the 'Memory' feature."]}, {'end': 827.813, 'segs': [{'end': 779.258, 'src': 'embed', 'start': 751.894, 'weight': 0, 'content': [{'end': 756.6, 'text': "But the problem is that our number system base 10 doesn't exactly line up with bytes very well.", 'start': 751.894, 'duration': 4.706}, {'end': 764.546, 'text': "So the cool thing about hexadecimal is because it's base 16, 16 is also, coincidentally, the maximum number, or the maximum,", 'start': 756.86, 'duration': 7.686}, {'end': 770.111, 'text': 'I should say range of numbers we can actually represent using four binary digits.', 'start': 764.546, 'duration': 5.565}, {'end': 775.795, 'text': 'So in other words, zero through 15 are the numbers that we can represent with four binary digits.', 'start': 770.371, 'duration': 5.424}, {'end': 779.258, 'text': 'If we write out 1111, that is equal to 15.', 'start': 775.835, 'duration': 3.423}], 'summary': 'Hexadecimal, base 16, can represent 0-15 with four binary digits.', 'duration': 27.364, 'max_score': 751.894, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KXwRt7og0gI/pics/KXwRt7og0gI751894.jpg'}, {'end': 815.468, 'src': 'embed', 'start': 791.328, 'weight': 1, 'content': [{'end': 797.213, 'text': "We'll never have a situation where we need like three hexadecimal digits to represent one byte of memory.", 'start': 791.328, 'duration': 5.885}, {'end': 800.736, 'text': 'Every hexadecimal digit is always essentially half a byte for bits.', 'start': 797.453, 'duration': 3.283}, {'end': 804.86, 'text': 'So two hexadecimal digits will always be one byte of memory.', 'start': 800.936, 'duration': 3.924}, {'end': 810.765, 'text': 'Whereas if you compare this to like a decimal number system, you know, eight bits, the largest number that it gives you is 255, which is three digits.', 'start': 804.98, 'duration': 5.785}, {'end': 815.468, 'text': 'anything above 100 becomes, well, it has to use a third digit.', 'start': 812.406, 'duration': 3.062}], 'summary': 'Hexadecimal system uses two digits to represent one byte, unlike decimal system which needs three digits for numbers over 100.', 'duration': 24.14, 'max_score': 791.328, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KXwRt7og0gI/pics/KXwRt7og0gI791328.jpg'}], 'start': 696.198, 'title': 'Understanding hexadecimal number system', 'summary': 'Explains the usage of hexadecimal, a base 16 number system, to represent binary data more efficiently, with each digit representing half a byte, enhancing readability and efficiency in binary data representation.', 'chapters': [{'end': 827.813, 'start': 696.198, 'title': 'Understanding hexadecimal number system', 'summary': 'Explains how hexadecimal, a base 16 number system, is used to represent binary data more efficiently, with each hexadecimal digit representing half a byte, making it more readable and efficient for representing binary data.', 'duration': 131.615, 'highlights': ['Hexadecimal is a base 16 number system, allowing it to efficiently represent binary data, with each hexadecimal digit representing four binary digits, making it more readable and compact. ', 'Hexadecimal digits line up perfectly with four bits, making it more efficient for representing bytes of memory, unlike the decimal number system, where numbers above 100 require an extra digit. ', 'Each hexadecimal digit always represents half a byte, making it more efficient for representing binary data, as compared to the decimal number system. ']}], 'duration': 131.615, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KXwRt7og0gI/pics/KXwRt7og0gI696198.jpg', 'highlights': ['Hexadecimal is a base 16 number system, allowing it to efficiently represent binary data, with each hexadecimal digit representing four binary digits, making it more readable and compact.', 'Each hexadecimal digit always represents half a byte, making it more efficient for representing binary data, as compared to the decimal number system.', 'Hexadecimal digits line up perfectly with four bits, making it more efficient for representing bytes of memory, unlike the decimal number system, where numbers above 100 require an extra digit.']}, {'end': 1276.895, 'segs': [{'end': 856.347, 'src': 'embed', 'start': 828.074, 'weight': 0, 'content': [{'end': 834.617, 'text': 'So anyway, hopefully all of that makes sense and you now know how the computer actually stores these values that we have inside memory.', 'start': 828.074, 'duration': 6.543}, {'end': 837.638, 'text': "Now, it's worth pointing out that we are dealing with integers here.", 'start': 835.197, 'duration': 2.441}, {'end': 842.16, 'text': "We're not dealing with like floats or doubles or whatever other data type.", 'start': 837.778, 'duration': 4.382}, {'end': 846.342, 'text': "Everything that I'm talking about here with these bits is really specific to integers.", 'start': 842.4, 'duration': 3.942}, {'end': 849.584, 'text': 'I mean, you can apply these bit operations to like floats.', 'start': 846.482, 'duration': 3.102}, {'end': 856.347, 'text': "You'll have to tell the compiler that you're interpreting that specific memory as a different data type for that to work, but it is possible.", 'start': 849.684, 'duration': 6.663}], 'summary': 'Computer stores integer values in memory using bits.', 'duration': 28.273, 'max_score': 828.074, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KXwRt7og0gI/pics/KXwRt7og0gI828074.jpg'}, {'end': 889.119, 'src': 'embed', 'start': 865.656, 'weight': 1, 'content': [{'end': 874.469, 'text': 'So we basically have, as I mentioned, a bit shift left, a bit shift right, an AND, a bitwise AND, a bitwise OR, an XOR, and a NOT operator.', 'start': 865.656, 'duration': 8.813}, {'end': 876.672, 'text': 'And this is the syntax for writing these.', 'start': 874.649, 'duration': 2.023}, {'end': 878.873, 'text': "So these two operators aren't used that often.", 'start': 876.892, 'duration': 1.981}, {'end': 880.554, 'text': 'I mean, this one is used for inverting bits.', 'start': 878.913, 'duration': 1.641}, {'end': 884.916, 'text': "It's kind of useful for like bit fields and storing various like flags inside types.", 'start': 880.634, 'duration': 4.282}, {'end': 889.119, 'text': 'XOR is kind of useful for like hashing and stuff like that.', 'start': 885.557, 'duration': 3.562}], 'summary': 'Various bitwise operators include shift, and, or, xor, and not. xor useful for hashing.', 'duration': 23.463, 'max_score': 865.656, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KXwRt7og0gI/pics/KXwRt7og0gI865656.jpg'}, {'end': 899.044, 'src': 'heatmap', 'start': 865.656, 'weight': 0.937, 'content': [{'end': 874.469, 'text': 'So we basically have, as I mentioned, a bit shift left, a bit shift right, an AND, a bitwise AND, a bitwise OR, an XOR, and a NOT operator.', 'start': 865.656, 'duration': 8.813}, {'end': 876.672, 'text': 'And this is the syntax for writing these.', 'start': 874.649, 'duration': 2.023}, {'end': 878.873, 'text': "So these two operators aren't used that often.", 'start': 876.892, 'duration': 1.981}, {'end': 880.554, 'text': 'I mean, this one is used for inverting bits.', 'start': 878.913, 'duration': 1.641}, {'end': 884.916, 'text': "It's kind of useful for like bit fields and storing various like flags inside types.", 'start': 880.634, 'duration': 4.282}, {'end': 889.119, 'text': 'XOR is kind of useful for like hashing and stuff like that.', 'start': 885.557, 'duration': 3.562}, {'end': 890.72, 'text': "But again, it doesn't get really much use.", 'start': 889.159, 'duration': 1.561}, {'end': 894.902, 'text': 'These two are very useful because the OR is essentially like an add.', 'start': 890.9, 'duration': 4.002}, {'end': 899.044, 'text': 'It lets us turn on certain bits and like combine bits essentially.', 'start': 895.062, 'duration': 3.982}], 'summary': 'Operators like bit shift, and, or, xor, and not are discussed, with or and and being very useful for combining and turning on certain bits.', 'duration': 33.388, 'max_score': 865.656, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KXwRt7og0gI/pics/KXwRt7og0gI865656.jpg'}, {'end': 970.366, 'src': 'heatmap', 'start': 930.351, 'weight': 0.718, 'content': [{'end': 937.636, 'text': 'So if we had a number like 0101, they shift the bits to the left or to the right by the amount of places that you specify.', 'start': 930.351, 'duration': 7.285}, {'end': 944.561, 'text': 'So in other words, if I took this A and I shifted it left by like one place, you can write this shift left operator like this.', 'start': 938.096, 'duration': 6.465}, {'end': 946.422, 'text': "By the way, it's kind of like writing plus equals.", 'start': 944.641, 'duration': 1.781}, {'end': 949.004, 'text': 'It will just store the result inside the variable itself.', 'start': 946.462, 'duration': 2.542}, {'end': 957.347, 'text': "what's going to happen with my number is i'm simply going to be shifting these bits by one place to the left, so in other words, this will become 1,", 'start': 949.404, 'duration': 7.943}, {'end': 961.697, 'text': "0, 1, 0, and i insert a 0 on this right side because there's nothing else here.", 'start': 957.347, 'duration': 4.35}, {'end': 970.366, 'text': 'so, effectively, what this has done is gone from the number 5 to the number 10, because now the 8 bit and the 2 bit are both on, which gives us 10..', 'start': 961.697, 'duration': 8.669}], 'summary': 'Shifting bits left by 1 place changes 0101 to 1010, transforming 5 to 10.', 'duration': 40.015, 'max_score': 930.351, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KXwRt7og0gI/pics/KXwRt7og0gI930351.jpg'}, {'end': 1040.631, 'src': 'embed', 'start': 1013.962, 'weight': 2, 'content': [{'end': 1021.51, 'text': 'So in other words, all a bit shift left and a bit shift right is, is really just a multiplication by 2 to the power of n for the bit shift left.', 'start': 1013.962, 'duration': 7.548}, {'end': 1024.753, 'text': 'So this is us shifting left by n places.', 'start': 1021.591, 'duration': 3.162}, {'end': 1029.459, 'text': 'And then this bit shift right is the same as dividing by 2 to the power of n.', 'start': 1025.013, 'duration': 4.446}, {'end': 1031.482, 'text': "And that's what that looks like.", 'start': 1030.16, 'duration': 1.322}, {'end': 1040.631, 'text': 'So, as an example, if we had a variable that was set to 10, and then I went ahead and shifted it left by like four places,', 'start': 1031.742, 'duration': 8.889}], 'summary': 'Bit shift left is a multiplication by 2^n, and right is division by 2^n.', 'duration': 26.669, 'max_score': 1013.962, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KXwRt7og0gI/pics/KXwRt7og0gI1013962.jpg'}, {'end': 1162.172, 'src': 'heatmap', 'start': 1130.736, 'weight': 1, 'content': [{'end': 1132.258, 'text': 'Can I use it for doubling and halving numbers??', 'start': 1130.736, 'duration': 1.522}, {'end': 1136.342, 'text': "Well, you can, but that's probably not what you wanna do with it.", 'start': 1132.718, 'duration': 3.624}, {'end': 1139.365, 'text': "A lot of like, let's just say, very smart.", 'start': 1136.683, 'duration': 2.682}, {'end': 1146.828, 'text': "people will think they're very smart because if they have a situation where they have like a number and they want to multiply it by, say, 16,", 'start': 1139.365, 'duration': 7.463}, {'end': 1153.93, 'text': "instead of writing sane code like this, they'll actually shift it left by four and then think that they're amazing.", 'start': 1146.828, 'duration': 7.102}, {'end': 1156.931, 'text': 'Because of course this will like, you know, produce a much faster program.', 'start': 1154.11, 'duration': 2.821}, {'end': 1158.051, 'text': "It's like you're optimizing everything.", 'start': 1156.951, 'duration': 1.1}, {'end': 1162.172, 'text': 'The thing is though, compilers are also very smart, smarter than you probably.', 'start': 1158.171, 'duration': 4.001}], 'summary': 'Using bit shifting instead of multiplication may not be the best optimization approach, as compilers are smarter.', 'duration': 31.436, 'max_score': 1130.736, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KXwRt7og0gI/pics/KXwRt7og0gI1130736.jpg'}, {'end': 1231.615, 'src': 'embed', 'start': 1207.411, 'weight': 3, 'content': [{'end': 1213.618, 'text': 'And if I again multiply this by something like 16, it will in fact become a shift left by four.', 'start': 1207.411, 'duration': 6.207}, {'end': 1221.487, 'text': "Similarly, if I take it and I divide it by 16, then you can see that becomes a shift right by four, as long as it's an unsigned integer.", 'start': 1213.798, 'duration': 7.689}, {'end': 1228.673, 'text': 'But as soon as I try something else, like dividing it by 15 or a non power of two, then it actually has to do some kind of division.', 'start': 1221.787, 'duration': 6.886}, {'end': 1231.615, 'text': 'And the same, of course, applies to multiplication.', 'start': 1228.993, 'duration': 2.622}], 'summary': 'Shifting by 16 results in left shift by four; dividing by 16 leads to right shift by four for unsigned integers.', 'duration': 24.204, 'max_score': 1207.411, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KXwRt7og0gI/pics/KXwRt7og0gI1207411.jpg'}], 'start': 828.074, 'title': 'Bitwise operators and bit shift', 'summary': 'Covers the use of bitwise operators in storing integer values in memory, including bit shift left, bit shift right, bitwise and, bitwise or, xor, and not. it also explains the optimization of bit shift left and bit shift right operators and their application to signed and unsigned types.', 'chapters': [{'end': 918.24, 'start': 828.074, 'title': 'Bitwise operators in integer data types', 'summary': 'Explains how computers store integer values in memory using bits and discusses various bitwise operators such as bit shift left, bit shift right, bitwise and, bitwise or, xor, and not, emphasizing their specific use with integers.', 'duration': 90.166, 'highlights': ['Computers store integer values in memory using bits, specifically dealing with integers and not other data types like floats or doubles. The chapter emphasizes that the discussion about bit operations is specific to integers and not other data types like floats or doubles.', 'Various operators such as bit shift left, bit shift right, bitwise AND, bitwise OR, XOR, and NOT are discussed, with emphasis on the practical uses of bitwise OR and AND for combining and masking bits in integer data types. The chapter discusses various bitwise operators such as bit shift left, bit shift right, bitwise AND, bitwise OR, XOR, and NOT, and emphasizes the practical uses of bitwise OR for combining bits and bitwise AND for masking bits in integer data types.', 'The usefulness of XOR for hashing and the usage of NOT for inverting bits are briefly mentioned, along with a note that they are not commonly used. The chapter briefly mentions the usefulness of XOR for hashing and the usage of NOT for inverting bits, with a note that they are not commonly used.']}, {'end': 1276.895, 'start': 918.28, 'title': 'Bit shift operators', 'summary': 'Explains the bit shift left and bit shift right operators, showing how they double or halve a number and their usage in multiplying and dividing by powers of 2, while highlighting that compilers automatically optimize for such operations. it also touches on the differences when applying these operators to signed and unsigned types.', 'duration': 358.615, 'highlights': ['The bit shift left and bit shift right operators double or halve a number, equivalent to multiplying or dividing by 2 to the power of n, respectively, as demonstrated by shifting a number left by 4 places resulting in multiplication by 16.', 'Compilers automatically optimize operations like doubling or halving a number through bit shifting, making manual optimization unnecessary, as shown by the compiler converting multiplication by 16 into a shift left by 4.', 'The chapter emphasizes that applying bit shift operators to signed or unsigned types can yield different results due to variations in the bit representation, and there are specific CPU instructions for each type, revealing the potential complexities in using these operators.', 'The chapter highlights the misconception of manually using bit shift operations for optimization, indicating that compilers are capable of automatically optimizing such operations and advising against trying to outsmart the compiler with manual optimization.']}], 'duration': 448.821, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KXwRt7og0gI/pics/KXwRt7og0gI828074.jpg', 'highlights': ['Computers store integer values in memory using bits, specifically dealing with integers and not other data types like floats or doubles.', 'Various operators such as bit shift left, bit shift right, bitwise AND, bitwise OR, XOR, and NOT are discussed, with emphasis on the practical uses of bitwise OR and AND for combining and masking bits in integer data types.', 'The bit shift left and bit shift right operators double or halve a number, equivalent to multiplying or dividing by 2 to the power of n, respectively, as demonstrated by shifting a number left by 4 places resulting in multiplication by 16.', 'Compilers automatically optimize operations like doubling or halving a number through bit shifting, making manual optimization unnecessary, as shown by the compiler converting multiplication by 16 into a shift left by 4.']}], 'highlights': ['Cherno acknowledges the delay in C++ series videos due to personal reasons and expresses commitment to continue, highlighting the need to cover various topics. (Relevance: 5)', 'The chapter introduces the basics of bitwise operators in C++, including the six main operators: bit shift left, bit shift right, bitwise AND, bitwise OR, bitwise XOR, and the NOT operator.', 'Hexadecimal is a base 16 number system, allowing it to efficiently represent binary data, with each hexadecimal digit representing four binary digits, making it more readable and compact.', "The 'int' data type is stored in 4 bytes of memory, with leading zeros representing the full byte of memory.", 'RAM uses capacitors with on and off states to represent zeros and ones in memory.']}