Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 alpha 4/15/85; site chalmers.UUCP Path: utzoo!watmath!clyde!burl!ulysses!gamma!epsilon!zeta!sabre!petrus!bellcore!decvax!ucbvax!ucdavis!lll-crg!seismo!mcvax!enea!chalmers!augustss From: augustss@chalmers.UUCP (Lennart Augustsson) Newsgroups: net.lang.c Subject: Re: Two Birds with One Stone Message-ID: <412@chalmers.UUCP> Date: Sun, 22-Dec-85 22:19:56 EST Article-I.D.: chalmers.412 Posted: Sun Dec 22 22:19:56 1985 Date-Received: Wed, 25-Dec-85 03:43:04 EST References: <874@dataioDataio.UUCP> <864@kuling.UUCP> Reply-To: augustss@chalmers.UUCP (Lennart Augustsson) Organization: Dept. of CS, Chalmers, Sweden Lines: 20 In article <864@kuling.UUCP> thomas@kuling.UUCP (Thomas H{meenaho) writes: >However most useable processors provide arithmetic shifts which will give >the right result even if it is a signed divide. Replacing a divide with a signed shift doesn't solve the problem. Consider the following: decimal binary -1 / 2 = 0 11111111 / 10 = 00000000 -1 >> 1 = -1 11111111 >> 1 = 11111111 Most machines behave like this when dividing, i.e. they divide the absolute value of the operands and then sets the correct sign. There are machines (e.g. NS 32000) which provide a divide instruction with the other behaviour. -- Any resemblance of the opinions above to real opinions, living or dead, is purely coincidential. Lennart Augustsson UUCP: {seismo,philabs,decvax}!mcvax!enea!chalmers!augustss ARPA,CSnet: augustss@chalmers.csnet