What is &= and |=

前端 未结 7 1310
独厮守ぢ
独厮守ぢ 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:52

    Its bitwise and or

    in the first case the flag (bit) is turned off

    nState &= ~TOOL_TIPS_VISIBLE
    

    in the second case the flag is turned on

    nState |= TOOL_TIPS_VISIBLE
    

提交回复
热议问题