What is &= and |=

前端 未结 7 1111
独厮守ぢ
独厮守ぢ 2021-01-18 07:31

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

    if (nState & TOOL_TIPS_VISIBLE)
        nState &= ~TOOL_TIPS_VISI         


        
7条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-18 07:45

    & and | are similar to && and ||, only they works in bitwise fashion. So now you could imagine &= and |= works similar to +=. That is x &= y; ==> x = x & y;

提交回复
热议问题