Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site tymix.UUCP Path: utzoo!watmath!clyde!burl!ulysses!gamma!epsilon!zeta!sabre!petrus!bellcore!decvax!decwrl!glacier!oliveb!tymix!kanner From: kanner@tymix.UUCP (Herb Kanner) Newsgroups: net.lang.c Subject: Re: Right shift vs. divide Message-ID: <605@tymix.UUCP> Date: Wed, 25-Dec-85 16:09:09 EST Article-I.D.: tymix.605 Posted: Wed Dec 25 16:09:09 1985 Date-Received: Sat, 28-Dec-85 00:57:34 EST References: <974@brl-tgr.ARPA> Reply-To: kanner@tymix.UUCP (Herb Kanner) Organization: Tymnet Inc., Cupertino CA Lines: 20 In article <974@brl-tgr.ARPA> Schauble@mit-multics.arpa (Paul Schauble) writes: >BTW, is >> defined to be a sign-extended shift or a zero extended shift >and under what circumstances. > I'm doing this at home from memory, without a copy of K & R at hand, so, please, no flames if I get it slightly wrong. My recollection of their definition of >> is that if the shifted variable is of type unsigned, it must be a zero-extended shift. If the shifted variable is of type int, it may be sign extended if the underlying hardware possesses such an instruction--I think this is a relatively non-commital way of saying that it will probably be implemented as a sign-extended shift on machines using two-complement notation for negative numbers. -- Herb Kanner Tymnet, Inc. ...!hplabs!oliveb!tymix!kanner