Bitwise Operators 1: The AND Operation

Поділитися
Вставка
  • Опубліковано 25 січ 2020
  • This computer science video describes the bitwise operation AND. It explains how the AND operation works with unsigned integers and how the bitwise AND operation can be used to determine whether an integer is positive or negative. It also shows how the AND operation can be used with a bitmask to manipulate the contents of a register containing bit flags. The equivalent AND operators are demonstrated in VB.NET, JavaScript and Python.

КОМЕНТАРІ • 31

  • @kevnar
    @kevnar 4 роки тому +15

    I used bitwise AND for a maze program I made. Every cell had an integer value for the exits. North = 1 East = 2 South = 4 West = 8. When the player tried to go up, I did a check of cellExits AND 1. If it was 0, the player could go north. No wall there. For west it was cellExits AND 8. If it returned 0, it was good to go. No wall there. Much easier than checking if canGoNorth = True for every direction and every cell.

  • @CLUBKILLE
    @CLUBKILLE 9 місяців тому +1

    It took you 2 minutes and 35 seconds and the light bulb clicked. Thank you so much!!!

  • @tinnguyentrung5122
    @tinnguyentrung5122 3 роки тому +7

    I was reading the C Programming Language by K&R and then I got stuck at the Bitwise Operator section. Your series saved me THANK YOU sir

  • @FabianOber
    @FabianOber Рік тому +1

    Really helpful, thank you so much. The example with the rooms is perfect for that! Helped me a lot! 🙏

  • @infinitebeast5517
    @infinitebeast5517 3 роки тому +6

    Thank you. Straightforward and informative.

  • @alejandragarciabuenaventur4013
    @alejandragarciabuenaventur4013 3 роки тому +5

    This was SO helpful! Thank you!

  • @sandipdas5684
    @sandipdas5684 4 роки тому +3

    Thank you so much sir for this clean explanation

  • @jimshtepa5423
    @jimshtepa5423 2 роки тому

    thank you for the material and great way of presentation. quick question: why need to apply a mask when it is already clear which room has heat turned on?

  • @uchennagodfrey8343
    @uchennagodfrey8343 Рік тому +1

    Thanks
    Really helpful

  • @alecgamer420
    @alecgamer420 11 місяців тому

    Thanks so much. This is a better explanation than my assembly language instructor was able to provide lol

  • @oshadhaedirisinghe1455
    @oshadhaedirisinghe1455 7 місяців тому

    Thank you

  • @pointer333
    @pointer333 Рік тому +2

    I finally get it!!! (More importantly, I finally get WHY this is useful!)

  • @Davidh2k
    @Davidh2k Рік тому +1

    Thank you for a the great explanation. Could it be that there slipped a minor error on the upstairs heaters check? That one would not show that all downstairs heaters are off, since even if they were on, the result of the bitmask comparision would be the same, wouldn't it?

    • @ComputerScienceLessons
      @ComputerScienceLessons  Рік тому

      You may well have spotted a 'typo'. Thanks for the heads up. I'll take a look. :)KD

  • @andrews4527
    @andrews4527 4 роки тому

    Now this is Epic Sir

  • @feiwang6380
    @feiwang6380 Рік тому +1

    Thank you Jarvis

  • @rodrigota7432
    @rodrigota7432 Рік тому +1

    thanks sir

  • @sandipdas5684
    @sandipdas5684 4 роки тому

    Sir, please make videos on michroprocessor and computer organization and architecture

    • @ComputerScienceLessons
      @ComputerScienceLessons  4 роки тому +1

      I'm working on memory address decoding at the moment. Please watch this space. :) KD

    • @sandipdas5684
      @sandipdas5684 4 роки тому

      @@ComputerScienceLessons okay sir..

  • @frostyrobot7689
    @frostyrobot7689 4 роки тому +1

    First view !!! and first Comment !!!!!

    • @ComputerScienceLessons
      @ComputerScienceLessons  4 роки тому +2

      Welcome. :) YT should start giving prizes or something.

    • @frostyrobot7689
      @frostyrobot7689 4 роки тому

      @@ComputerScienceLessons haha yeah, cheers - and thanks very much for posting this great content.