Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!pasteur!ucbvax!agate!shelby!portia!edgar From: edgar@portia.Stanford.EDU (Edgar Holmann) Newsgroups: comp.sys.mips Subject: Redefinition of left shift operator Message-ID: <4724@portia.Stanford.EDU> Date: 22 Aug 89 20:37:33 GMT Sender: Edgar Holmann Reply-To: edgar@Neon.Stanford.EDU (Edgar Holmann) Distribution: usa Organization: Stanford University Lines: 22 Has the left shift operator been redefined in the MIPS systems from the typical shift to a modulo type shift? By this I mean: i << j redefined to i << (j % 32) This is evident when you shift by a quantity larger than or equal to the int size (32). When j is a constant, the compiler issues a warning message (when using the optimizer level 2 or 3). Now, I see that nobody should be shifting by a constant larger than 32 but what about shifting by another variable when creating a mask? Thus, a simple statement of the form (1L << j) - 1 or ~(~0 << j) now has to have a conditional to handle the case when j is 32. I have tried this on an R3000 running Ultrix 3.1 with cc1.31. The same result is obtained in an R2000. Is this considered a "feature" of the mips compiler or is it something that will get changed in a new release? edgar