Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site alice.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!alice!ark From: ark@alice.UucP (Andrew Koenig) Newsgroups: net.arch Subject: Re: Right shift vs. divide Message-ID: <4772@alice.UUCP> Date: Fri, 3-Jan-86 23:17:41 EST Article-I.D.: alice.4772 Posted: Fri Jan 3 23:17:41 1986 Date-Received: Sat, 4-Jan-86 06:03:46 EST References: <124000005@ima.UUCP> Organization: Bell Labs, Murray Hill Lines: 12 > Now that we know that right shifting is not the same as division, has > anybody ever come up with a plausible reason for computers to have > arithmetic shift instructions on twos complement machines (other than that > they're easy to implement and poorly educated engineers might have thought > they were the same as division)? For positive numbers, they give the same > result as unsigned shifts, and for negative numbers they give the wrong > answer. Followups to net.arch, please. I can think of two reasons: (1) sometimes you want to divide with truncation toward -infinity and an arithmetic right shift gives you that; (2) on some machines, an arithmetic left shift lets you multiply by a power of 2 with overflow checking.