Google Mail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Unexpected behavior shifting uint 32 bits
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Follow-up To:
Add Cc | Add Follow-up to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers that you hear
 
nickdu  
View profile   Translate to Translated (View Original)
 More options 22 Sep, 14:15
Newsgroups: microsoft.public.dotnet.framework.clr
From: nickdu <nicknospa...@community.nospam>
Date: Tue, 22 Sep 2009 06:15:01 -0700
Local: Tues 22 Sep 2009 14:15
Subject: Unexpected behavior shifting uint 32 bits
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

--
Thanks,
Nick

nicknospa...@community.nospam
remove "nospam" change community. to msn.com


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Stephen Myers  
View profile   Translate to Translated (View Original)
 More options 22 Sep, 18:20
Newsgroups: microsoft.public.dotnet.framework.clr
From: Stephen Myers <""StephenMyers\"@discussi...@microsoft.com">
Date: Tue, 22 Sep 2009 12:20:49 -0500
Local: Tues 22 Sep 2009 18:20
Subject: Re: Unexpected behavior shifting uint 32 bits

 From VS 2008 Documentation

 >> Operator (C# Reference)

If the first operand is an int or uint (32-bit quantity), the shift
count is given by the low-order five bits of the second operand (second
operand & 0x1f).

Steve


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google