I'm working with a cool program from a book that uses a mask to print an integer's binary equivalent. I've never used a mask before so it's kind of new to me. If my integer is 123(0111 1011) and my mask value is defined initially as 1000 0000(which is 128), then the first time through the compiler is doing this:

0
1

Then it prints a 0 since 0 AND 1 gives you 0. Then I right shift my mask value over to the right by one place so my mask value is 0100 0000. Then I go again:

1
1

This time it prints a 1 because 1 AND 1 gives you a 1. Then I shift my mask value over to the right one place again so it looks like 0010 0000. Then I go again:

1
1

This time it again prints a 1 since 1 AND 1 gives you a 1. This process repeats until done and the loop terminates.

My question is you can see that the compiler is working with only one column at a time. It's working with the column that has the 1 bit in the mask value. What's the reason for this? Is this why they call it a mask? Because when you put 0's in all the other positions of your mask, the compiler ignores or becomes blind to those other neighboring columns?