Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!bbn!apple!well!ewhac From: ewhac@well.UUCP (Leo 'Bols Ewhac' Schwab) Newsgroups: comp.sys.amiga Subject: Re: C help Message-ID: <11238@well.UUCP> Date: 5 Apr 89 09:05:50 GMT References: <19888@srcsip.UUCP> Reply-To: ewhac@well.UUCP (Leo 'Bols Ewhac' Schwab) Organization: Hole Earth 'Lectronic Loss (or words to that effect) Lines: 38 Quote: "I plan to live forever -- or die trying." -- Vila In article <19888@srcsip.UUCP> carpent@coltrane.SRC.Honeywell.COM (Todd Carpenter) writes: >void moo(state,new_state) > ushort state[NUM_STATES], new_state[NUM_STATES]; >{ > ushort i; > > for (i = 0; i != NUM_STATES; i++) > new_state[i] = state[i]; > > ... >} > >Anyone have any significantly faster ideas? Blitter? Number of states may be >up to 256. > CopyMem (new_state, state, (LONG) NUM_STATES * sizeof (ushort)); Is there any particular reason why you have to undo the whole table? If you were to re-write the algorithm to undo only those elements that needed undoing, you'd save a lot of time. >However, if I remember right, all divides in C are, by definition, done in >double floating point. [ ... ] A zillion other people are going to say this, too, and will probably quote K&R or DpANS chapter and verse. If all the operands in an expression are integers, then the evaluation of the expression is done using integer arithmetic. If you stick any floats or doubles in there, then floating point arithmetic will be used (though not necessarily throughout the expression (watch me get toasted for that one)). _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ Leo L. Schwab -- The Guy in The Cape INET: well!ewhac@ucbvax.Berkeley.EDU \_ -_ Recumbent Bikes: UUCP: pacbell > !{well,unicom}!ewhac O----^o The Only Way To Fly. hplabs / (pronounced "AE-wack") "Work FOR? I don't work FOR anybody! I'm just having fun." -- The Doctor