Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site l5.uucp Path: utzoo!watmath!clyde!burl!ulysses!gamma!epsilon!zeta!sabre!petrus!bellcore!decvax!decwrl!sun!l5!gnu From: gnu@l5.uucp (John Gilmore) Newsgroups: net.lang.c Subject: Re: Right shift vs. divide Message-ID: <361@l5.uucp> Date: Thu, 26-Dec-85 20:23:05 EST Article-I.D.: l5.361 Posted: Thu Dec 26 20:23:05 1985 Date-Received: Sat, 28-Dec-85 01:31:54 EST References: <974@brl-tgr.ARPA> Organization: Nebula Consultants in San Francisco Lines: 23 You can compile divides to right-shifts without *too* much effort... The Sun Unix "3.0 Pilot" compiler compiles this: int i = -15; int j; main() { j = i / 4; } ----into---- _main: link a6,#0 movl _i,d0 jge L2000000 addql #3,d0 L2000000: asrl #2,d0 movl d0,_j unlk a6 rts ---- Still a lot faster than a divide!