Left and Right Shift

Learn how to multiply and divide by two in binary (or any power of two!)

Пікірлер: 43

  • @bossgirl9176
    @bossgirl91764 жыл бұрын

    I've got a computer science examination tomorrow and I found your video extremely helpful thank you

  • @DrMadPotato
    @DrMadPotato7 жыл бұрын

    Teach better than my teacher! And it's such a simple thing

  • @theatomgamers3115
    @theatomgamers31158 жыл бұрын

    Got a computing exam coming up, This really helped, thanks mate.

  • @SunitaSharma-nc4zq
    @SunitaSharma-nc4zq6 жыл бұрын

    I can't understand this topic in any of the lecture video but only this works thanks a lot for this simple nice and wonderful video I respect your teaching

  • @Abdulisbasith
    @Abdulisbasith5 жыл бұрын

    Helped me clear so many doubts , Thanks Mr Powell's Computer Science Channel

  • @rubyc967
    @rubyc9676 жыл бұрын

    Thank you so much!! This is so simple haha

  • @RishikaSinghthetraveler
    @RishikaSinghthetraveler7 жыл бұрын

    Thanks very helpful

  • @blackstreet23
    @blackstreet238 жыл бұрын

    Thanks this was really useful !!!!

  • @zeefer9867
    @zeefer98676 жыл бұрын

    so clear, very nice,

  • @Shkencetari
    @Shkencetari7 жыл бұрын

    Thank you very much :)

  • @tpwk1282
    @tpwk12825 жыл бұрын

    Thank you so much for this

  • @bollyhunt7083
    @bollyhunt70837 жыл бұрын

    nice. and easy to understand

  • @NinjaCokeGaming
    @NinjaCokeGaming6 жыл бұрын

    thanks Mr Powell!!!!!!

  • @khaldounal-nuaimi3594
    @khaldounal-nuaimi35945 жыл бұрын

    Thank you!

  • @aura9654
    @aura96545 жыл бұрын

    thanks man helped a lot :)

  • @Toturials
    @Toturials6 жыл бұрын

    Thank you very much

  • @burgerking220
    @burgerking2204 жыл бұрын

    Thank you very much.

  • @hooramahi8441
    @hooramahi84415 жыл бұрын

    thanks very good video

  • @lawalabdulateefolawale4548
    @lawalabdulateefolawale45485 жыл бұрын

    fantastic .......thanks

  • @shaheryarahmad5871
    @shaheryarahmad58715 жыл бұрын

    Good Easy to Understand

  • @sunlime3347
    @sunlime33476 жыл бұрын

    Thank you

  • @jes2276
    @jes22766 жыл бұрын

    Have you done a rotate binary video?

  • @Dr_Ali.Aljboury
    @Dr_Ali.Aljboury5 жыл бұрын

    Thanks for explaining. So may I know where we using these shifts and one more things how you make 5 or 10 after equal? Thanks

  • @mrpowellscomputersciencech7120

    @mrpowellscomputersciencech7120

    5 жыл бұрын

    Binary shifts are used to quickly multiply / divide by powers of two. They can also be used to zero out lower or upper bits (although bitwise and would probably be better), they can also be used in binary multiplication. I am sure there are other uses. I am not sure I understand your second question.

  • @ahmedulhaquefuad280
    @ahmedulhaquefuad2805 жыл бұрын

    64, 32, 16, 8, 4, 2, 1 for 7 bit

  • @theo9743
    @theo97437 жыл бұрын

    whats the difference between a logical left shift and a arithmetic left shift?

  • @mrpowellscomputersciencech7120

    @mrpowellscomputersciencech7120

    7 жыл бұрын

    There is no difference. There is however a difference for right shift. A logical right shift just shifts the bits along and fills the gap left at the left hand end with a zero - it is moving the place of the bits. An arithmetic right shift copies the most significant bit. This is useful when using two's complement numbers: -8 4 2 1 1 1 0 0 - this is two's complement for -4 0 1 1 0 - logical right shift has become positive 6- although it has moved the bit order 1 1 1 0 - arithmetic right shift - the gap is filled with the old most significant bit. -4 right shifted has become -2

  • @asdf256

    @asdf256

    6 жыл бұрын

    Thank you so much for explaining this simply. My professor doesn't teach us anything and the textbook is too in-depth.

  • @yagzyalcntas553

    @yagzyalcntas553

    6 жыл бұрын

    Thank you for your answer been looking for this for half an hour and no ..... one does signed shifting! including you but at least in comments you did it. and another question if we do signed shift of positive number 0110 for example we will again copy msb which is 0 right? i havent came across any positive signed shifting made me question does signed mean negative or something...

  • @irenenastatchenko905

    @irenenastatchenko905

    5 жыл бұрын

    msb will be copied anyway when using arithmetic right shift: either it is 1 or 0. The empty position in the most significant bit is filled with a copy of the original MSB.

  • @roushanraj2155
    @roushanraj21558 жыл бұрын

    thankssssssssssssssssssssssss

  • @tanuj1253
    @tanuj12537 жыл бұрын

    What if you left shift the number 10 twice in hexadecimal(8 4 2 1)?

  • @mrpowellscomputersciencech7120

    @mrpowellscomputersciencech7120

    7 жыл бұрын

    I am not quite sure what you mean. b10 as a binary number left shifted twice will be b1000 - or from 2 denary to 8 denary (and indeed from x2 to x8). If you mean x10 left shifted then x10 = b10000 and so left shifted is b01000000 which is x40 or denary 64. Lastly, if you are shifting places in hex then x10 would be x1000 which is whatever 16x16x16 is in denary.

  • @michaelattard2634
    @michaelattard26346 жыл бұрын

    well done m8 very good enjoyed your lesson

  • @grainfrizz
    @grainfrizz4 жыл бұрын

    3

  • @anoshaaziz7332
    @anoshaaziz73325 жыл бұрын

    nice

  • @naziasultana1860
    @naziasultana18605 жыл бұрын

    Thats my teacher

  • @Rawoonah2cool
    @Rawoonah2cool7 жыл бұрын

    At 2:37 when I tried to shift again I got 4 shouldn't I get 20?

  • @mrpowellscomputersciencech7120

    @mrpowellscomputersciencech7120

    7 жыл бұрын

    If you use five or more bits to represent the number then you will get 20. In this case we were using just four bits which can represent the numbers 0-15 only - hence 20 won't fit in. If you left shift and have not got enough bits to represent the number then a computer processor will usually set an overflow flag. How to check for overflow varies between languages and architectures. The number of bits use to represent basic types like integers will vary too.

  • @tokihossoin7861
    @tokihossoin78616 жыл бұрын

    Safe bro

  • @mohithkumar9210
    @mohithkumar92105 жыл бұрын

    8 4 2 1 0 0 11 --> 3 --LS 1bit --> *2. This part is ok But if the register is has a fixed memory of 4 bit then the output should not go beyond 16, or you have an overflow, so for the above example it is necessary to restrict the operation to 2 left shifts only. Am i right? example: 8 4 2 1 1 0 1 1 -->LS, 1 bit != *2.

  • @mrpowellscomputersciencech7120

    @mrpowellscomputersciencech7120

    5 жыл бұрын

    It isn't necessary to restrict it to 2 left shifts, but you will lose data. Consider a 32 bit IP address 192.168.1.45. if I do ip > 24 then I get left with 45. If I want to check if the most significant bit of a number is a 1 then I could do if ((number1==number) {}. This isn't the most effective way to do it, but it does work.