Path: utzoo!utgpu!water!watmath!clyde!att!pacbell!ames!mailrus!uflorida!umd5!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.arch Subject: Re: Shifting question Message-ID: <12629@mimsy.UUCP> Date: 22 Jul 88 00:39:05 GMT References: <705@bnr-rsc.UUCP> <440@softway.oz> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 19 In article <440@softway.oz> stephenf@softway.oz (Stephen Frede) writes: >Contrary to the other two follow-ups I've seen .... The C language >(both K+R and X3J11) guarantees that X >> n is a logical shift, with >0 padding on the left, when X is an unsigned quantity, as it is in this >case. It is only when X is not unsigned, that a right shift is >implementation dependant. This is correct. The amount of the shift, however, must not be negative, or greater than or equal to the length of the object in bits (K&R, p. 189). Since this was `x >> 32' and x was a 32 bit (or smaller) object, the amount of the shift was too large, and the result is thus undefined, before we ever get to the question as to whether the result is implementation defined. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris