Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is &= and |=

I was going through some VC++ code in a large code-base and came across this:

    if (nState & TOOL_TIPS_VISIBLE)
        nState &= ~TOOL_TIPS_VISIBLE;
    else
        nState |= TOOL_TIPS_VISIBLE;
    break;

Is there any such operator as &= or |= in C++? What is it for?
Is it the equivalent of nState = nState & ~TOOL_TIPS_VISIBLE?

like image 776
Nav Avatar asked Nov 04 '11 08:11

Nav


1 Answers

x &= y is the same as x = x & y
x |= y is the same as x = x | y

like image 71
wallyk Avatar answered Oct 08 '22 19:10

wallyk