Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!lll-winken!unixhub!shelby!neon!kaufman From: kaufman@Neon.Stanford.EDU (Marc T. Kaufman) Newsgroups: comp.sys.mac.programmer Subject: Re: Increment (Was Re: Pascal deficiency)? Message-ID: <1990Dec18.031626.12262@Neon.Stanford.EDU> Date: 18 Dec 90 03:16:26 GMT References: <1990Dec18.001753.3756@Neon.Stanford.EDU> <49832@cornell.UUCP> Organization: Computer Science Department, Stanford University Lines: 20 In article <49832@cornell.UUCP> wayner@cello.cs.cornell.edu (Peter Wayner) writes: >kaufman@Neon.Stanford.EDU (Marc T. Kaufman) writes: -> ++i; -> ADDQ.L #$1,i ->Behold. The 68K does, indeed, have an instruction to increment variables in ->memory. >This is good information, but how many cycles does each of these take? >They are both going to memory, incrementing and returning a value. >...but it is not clear that just using one instruction is faster than using 3. >Anyone have a 680?0 manual handy? Well, we could just resort to first principles and note that to add 1 to a location in memory requires both reading the old value and writing the new value. Even RISC machines are constrained to do that. In fact, the ADDQ is one of the faster instructions, as it is only 16 bits with no extensions. Marc Kaufman (kaufman@Neon.stanford.edu)