Path: utzoo!utgpu!cs.utexas.edu!uunet!mcsun!unido!ira.uka.de!smurf!urlichs From: urlichs@smurf.sub.org (Matthias Urlichs) Newsgroups: alt.hackers Subject: Re: credit 'fixing' Message-ID: Date: 10 Mar 91 17:44:16 GMT References: <1991Feb21.154633.20781@bronze.ucs.indiana.edu> Organization: University of Karlsruhe, FRG Lines: 29 Approved: Me, myself, and I In alt.hackers, article , hughes@bigbang.Berkeley.EDU (Eric Hughes) writes: < In article <1991Feb21.154633.20781@bronze.ucs.indiana.edu> jkonrath@silver.ucs.indiana.edu (jon) said something like: < << The "lack of knowledge around me" wrote: << IF top = 8 THEN << top = 0 << ELSE << INC(top) << END; << where i just did << top := (top+1)MOD8 < < Now wait! The first code will (on most compilers) execute much faster, < since there's no division instruction generated. Put this fragment < inside a loop, and you've got a significant performance difference. < Ahem, did it occur to anyone that the first example is modulo 9 ? :-) ObHack: Well, right now I'm writing a news reading program. The thing is so full of hacks (both in the good and bad sense) that I don't know where to begin, so I won't. However, the _real_ hackery is going to start soon, when I'll be converting the code from Object Pascal to C++. (I'm getting fed up with having neither decent macros, inline functions, nor constructor/destructor functions.) -- Matthias Urlichs -- urlichs@smurf.sub.org -- urlichs@smurf.ira.uka.de /(o\ Humboldtstrasse 7 - 7500 Karlsruhe 1 - FRG -- +49-721-621127(0700-2330) \o)/