When say mask with another number

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By suresh99

Hi,
When say mask with another number in C++, does it mean AND/OR mask? I am new to c++.

Thanks

:bust_in_silhouette: Reply From: jaguar1983

Generally, when talking about masks, it will mean AND. Technically, an OR operation is a combination, rather than a mask.

When using AND returns only the parts where the two values overlap, so I believe the reasoning behind the naming is that it’s named after masking in art, where you use tape or a stencil to “mask out” the areas you don’t want to affect/see.

Hope that makes it a bit clearer.