I have the following C++ lines:
if(fromPos.x == 0xFFFF){
if(fromPos.y & 0x40){
fromIndex = static_cast<uint8_t>(fromPos.z);
}
else{
fromIndex = static_cast<uint8_t>(fromPos.y);
}
}
else
fromIndex = fromStackPos;
but I have no idea how to make use of fromPos.y & 0x40 in C#, doing it the way it is in C++ doesn't work on CSharp
In C++, the condition in an if
statement doesn't have to be a Boolean expression - but it does in C#. You just need to check for the result being non-zero:
if ((fromPos.y & 0x40) != 0)
(The brackets are required due to precedence; !=
binds tighter than &
.)
See more on this question at Stackoverflow