nickdu
2009-09-22 13:15:01 UTC
While I had a bug in my code where a variable was typed as a uint as opposed
to a ulong, I was surprised to find that shifting a uint right 32 bits did
not produce a zero. Instead it appears the uint was not modified. Is there
a reason for this?
The below sample:
using System;
public class Application
{
public static void Main()
{
uint value = 4;
value = value >> 32;
Console.WriteLine("value = {0}", value);
}
}
generates:
value = 4
to a ulong, I was surprised to find that shifting a uint right 32 bits did
not produce a zero. Instead it appears the uint was not modified. Is there
a reason for this?
The below sample:
using System;
public class Application
{
public static void Main()
{
uint value = 4;
value = value >> 32;
Console.WriteLine("value = {0}", value);
}
}
generates:
value = 4
--
Thanks,
Nick
***@community.nospam
remove "nospam" change community. to msn.com
Thanks,
Nick
***@community.nospam
remove "nospam" change community. to msn.com