I was reading a game programming book, and I came across an operator that I never say before, it waswas does that symbolize?Code:|=
This is a discussion on |= operator within the C++ Programming forums, part of the General Programming Boards category; I was reading a game programming book, and I came across an operator that I never say before, it was ...
I was reading a game programming book, and I came across an operator that I never say before, it waswas does that symbolize?Code:|=
It means set the variable to itself or'd with the operand. In other words:
Code:int x = 1; x |= 6; // set x equal to x or'd with 6
bit∙hub [bit-huhb] n. A source and destination for information.
its shorthand for x = x | 6;
Just like x += 6 is shorthand for x = x + 6
"You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter