Это видео недоступно.
Сожалеем об этом.

Left and Right Shift

Поделиться
HTML-код
  • Опубликовано: 12 авг 2024
  • Learn how to multiply and divide by two in binary (or any power of two!)

Комментарии • 43

  • @bossgirl9176
    @bossgirl9176 4 года назад +50

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

  • @theatomgamers3115
    @theatomgamers3115 8 лет назад +23

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

  • @DrMadPotato
    @DrMadPotato 7 лет назад +78

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

  • @Abdulisbasith
    @Abdulisbasith 5 лет назад +3

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

  • @SunitaSharma-nc4zq
    @SunitaSharma-nc4zq 6 лет назад +24

    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

  • @rubyc967
    @rubyc967 6 лет назад +20

    Thank you so much!! This is so simple haha

  • @blackstreet23
    @blackstreet23 8 лет назад +1

    Thanks this was really useful !!!!

  • @aura9654
    @aura9654 5 лет назад

    thanks man
    helped a lot :)

  • @RishikaSinghthetraveler
    @RishikaSinghthetraveler 7 лет назад +6

    Thanks very helpful

  • @jes2276
    @jes2276 6 лет назад +1

    Have you done a rotate binary video?

  • @tpwk1282
    @tpwk1282 5 лет назад +1

    Thank you so much for this

  • @zeefer9867
    @zeefer9867 6 лет назад +2

    so clear, very nice,

  • @Shkencetari
    @Shkencetari 8 лет назад +4

    Thank you very much :)

  • @bollyhunt7083
    @bollyhunt7083 7 лет назад +1

    nice. and easy to understand

  • @Dr_Ali.Aljboury
    @Dr_Ali.Aljboury 5 лет назад +1

    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.

  • @NinjaCokeGaming
    @NinjaCokeGaming 6 лет назад +1

    thanks Mr Powell!!!!!!

  • @khaldounal-nuaimi3594
    @khaldounal-nuaimi3594 5 лет назад +2

    Thank you!

  • @tanuj1253
    @tanuj1253 7 лет назад +1

    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.

  • @hooramahi8441
    @hooramahi8441 5 лет назад +1

    thanks very good video

  • @Toturials
    @Toturials 6 лет назад +1

    Thank you very much

  • @lawalabdulateefolawale4548
    @lawalabdulateefolawale4548 5 лет назад +1

    fantastic .......thanks

  • @burgerking220
    @burgerking220 4 года назад +1

    Thank you very much.

  • @shaheryarahmad5871
    @shaheryarahmad5871 5 лет назад +1

    Good
    Easy to Understand

  • @theo9743
    @theo9743 7 лет назад +5

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

    • @mrpowellscomputersciencech7120
      @mrpowellscomputersciencech7120  7 лет назад +13

      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 6 лет назад

      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.

  • @sunlime3347
    @sunlime3347 6 лет назад

    Thank you

  • @roushanraj2155
    @roushanraj2155 8 лет назад +6

    thankssssssssssssssssssssssss

  • @ahmedulhaquefuad280
    @ahmedulhaquefuad280 5 лет назад +1

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

  • @naziasultana1860
    @naziasultana1860 5 лет назад +2

    Thats my teacher

  • @Rawoonah2cool
    @Rawoonah2cool 7 лет назад

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

    • @mrpowellscomputersciencech7120
      @mrpowellscomputersciencech7120  7 лет назад +1

      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.

  • @michaelattard2634
    @michaelattard2634 6 лет назад

    well done m8 very good enjoyed your lesson

  • @anoshaaziz7332
    @anoshaaziz7332 5 лет назад

    nice

  • @grainfrizz
    @grainfrizz 4 года назад

    3

  • @tokihossoin7861
    @tokihossoin7861 6 лет назад

    Safe bro

  • @mohithkumar9210
    @mohithkumar9210 5 лет назад

    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.