the line \"if(arg2 & 1)\" in C++(arg2 is DWORD) is equal to \"if(arg2 & 1==0)\" in C#(arg2 is Uint32),right?
I am trying to translate a function from C++ to
Where you write :
if (arg1 & arg2==0)
The compiler understands :
if (arg1 & (arg2==0))
You should write :
if ((arg1 & arg2) == 0)
This is the way the C++ statement should be translated to C# :
if (arg2 & 1) // C++ (arg2 is DWORD)
if ((arg2 & 1) != 0) // C# (arg2 is Uint32)
Or, in a more generic way:
if (Flags & FlagToCheck) // C++
if ((Flags & FlagToCheck) != 0) // C#
In C/C++, 0 is false, everything else is true.