I have in C++
r.bits[k] &= 0xFF ^ msk;
So in Java
r.bits[k] = r.bits[k] & 0xFF,
but what is the meaning of the caret symbol? msk
also will contain hexadecimal values.
开发者_运维问答I know the caret symbol is a type of pointer in C++ but not sure what it is doing here.
Please explain.
The ^ symbol represents the bitwise XOR operator in C, C++. List of operators in C, C++.
The same operator is available for Java as well. XOR Operator in Java.
The caret means bitwise XOR
The caret does NOT mean a kind of pointer in C++ (though MSVC++ has extension for C++/CLI that use that symbol)
Caret symbol in C++ means XOR logical operation. Meaning for the code 0xFF ^ msk;
is that you take bits in msk and invert them (zeroes to ones and vice versa)
The carat symbol is the xor operator see here
The ^
is bitwise XOR.
For example:
1 ^ 1 = 0
2 ^ 1 = 3
0 ^ 1 = 1
If you are using C++/CLI then it is also a kind of reference (handle).
精彩评论