Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!samsung!noose.ecn.purdue.edu!iuvax!copper!bomgard From: bomgard@copper.ucs.indiana.edu (Tim Bomgardner) Newsgroups: comp.lang.c Subject: Re: shift left arithmetic Message-ID: <57871@iuvax.cs.indiana.edu> Date: 10 Sep 90 23:16:04 GMT References: <2098@charon.cwi.nl> <3973@bingvaxu.cc.binghamton.edu> <2101@charon.cwi.nl> Sender: news@iuvax.cs.indiana.edu Organization: Indiana University, Bloomington IN. Lines: 17 In article <2101@charon.cwi.nl> aeb@cwi.nl (Andries Brouwer) writes: }vu0310@bingvaxu.cc.binghamton.edu (R. Kym Horsell) writes: } }#>While debugging an Australian computer algebra package }#>I stumbled over the following: 1<<32 produced 0, but }#>int a; a=1; a<<32 produced 1. (Of course the word length } }#Compiler (may not be) broken -- try 1L<<32. (You didn't }#say that the size of _int_'s was 32 bits). } }True, but in fact it was, and 1<<32 and 1L<<32 produce the same results. For those who might be interested: Microsoft C (5.1) produced different results depending on the use of 16 or 32 bit integers, but at least one case would always produce a non-zero result. Turbo C 2.0 always produced 0's in all cases.