Code: Select all
if(i==0 ^ j==0) //openlist[2][0] is the G cost
openlist[2][0].push_back(10);
In an implementation of the A* pathfinding algorithm, I want the second line to be executed whenever i is 0 or j is 0, but not when both are 0. That's an exclusive OR. Looks like there is no logic XOR, only a "bitwise XOR", whatever that means.
In any case Visual Studio 2003 gives a warning C4554, which seems to indicate that the XOR operator might not do what I want it to do. Should I worry about this? Or should I write another if condition between the 1st and 2nd lines?