X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: Mok-Kong Shen Newsgroups: comp.os.msdos.djgpp Subject: Re: bit shifting problem Date: Thu, 10 Feb 2005 11:27:13 +0100 Organization: T-Online Lines: 16 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.t-online.com 1108031098 03 6658 qTeQrrFlFKikQ+V 050210 10:24:58 X-Complaints-To: usenet-abuse AT t-online DOT de X-ID: Tbk4fGZYZeVXjGwlkmseAOy2uATKnP+fvfqGAoEuevw8Lfodza7gE5 User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en In-Reply-To: To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk Mok-Kong Shen wrote: > > Sorry for posing yet another, possibly also newbie, problem. > In the following code I expected the values of k and n to be > both 0, since shifting 32 bits for a 32-bit word effectively > clears it. ......... [snip] Apology. I have known the answer. Shifting by 32 for a 32-bit quantity is undefined in the standard. gcc simply does nothing in this situation, both for the left and the right shift. M. K. Shen