What do the |=, &= and ~ do?
mode |= MyEnum.ROTATE;
mode &= ~MyEnum.RESHAPE;
Update:
Many of the answers simply said their bitwise this and bitwise that which did not help since i did not know what bitwise meant. Here’s a good intro.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Those are bitwise operations.
is the same as
or in other words we are adding ROTATE to the mode.
The secone example removes RESHAPE from the mode
modeis a bitmask