In the C++ program, there is a statement with bit operations as follows:
st_mask = 0xFFFFFFFF^(3<<st_shift);
With the exact same syntax in Visual Studio, an error message is shown:
Cannot implicitly convert type 'long' to 'int'. An explicit conversion exists (are you missing a cast?)
We end up with the following in C#
st_mask = (unchecked ((int) 0xFFFFFFFF)) ^ (3 << st_shift);
We need a cast to int and unchecked type.