I was looking for methods to perform a binary rotational shift in C # and scored good answers, for example qaru.site/questions/183565 / ... or qaru.site/questions/161642 / ...
I wanted to create a test file for this scenario, where a non-rotating shift would serve as a negative test, but then I came across this:
public static void Main()
{
Debug.WriteLine("1<<31 = " + Convert.ToString(1 << 31, 2).PadLeft(32, '0'));
Debug.WriteLine("1<<32 = " + Convert.ToString(1 << 32, 2).PadLeft(32, '0'));
}
Provides the following result:
1<<31 = 10000000000000000000000000000000
1<<32 = 00000000000000000000000000000001
Now this seems strange to me, as there are many answers that provide a method of binary shift and rotation using tricks such as binary OR, etc. But it seems that the default behavior of .NET should rotate.
Has this behavior changed in the new version of .NET? I tried this in Visual Studio 2010 before .NET 2.0, and it always shows the above behavior.
"" , ? - ?