Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84 SMI; site sun.uucp
Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!decvax!decwrl!sun!guy
From: guy@sun.uucp (Guy Harris)
Newsgroups: net.micro.68k,net.arch
Subject: Re: Infrequency of integer multiplies
Message-ID: <2352@sun.uucp>
Date: Wed, 26-Jun-85 05:00:37 EDT
Article-I.D.: sun.2352
Posted: Wed Jun 26 05:00:37 1985
Date-Received: Fri, 28-Jun-85 00:42:42 EDT
References: <1109@peora.UUCP> <5716@utzoo.UUCP> <659@lll-crg.ARPA> <1580@druil.UUCP>
Organization: Sun Microsystems, Inc.
Lines: 22
Xref: watmath net.micro.68k:972 net.arch:1493

> But what about arrays of structures?  These too will cause implicit
> multiplies when referenced as below:
> 
> 	blotto[i].xyzzy = 21;
> 
> I know, I know, in C you should assign a structure pointer to
> &blotto[i] and all that,

Besides, computing &blotto[i] and assigning it to a pointer *still* requires
a multiplication; it merely means that if you manipulate several elements of
blotto[i] in a row, or perform several operations on blotto[i].xyzzy, or
both, you can do the computation once and reuse the result.

If you're cycling through the array "blotto", a strength reduction will
(again) eliminate the multiplication (the compiler would also have to do the
trick of saving &blotto[i] in a pointer for you).

I've seen exactly that sort of code in something that at least purported to
be generated by DEC's PDP-11 Fortran IV compiler (not F4P, but the threaded
code compiler - it was a binary of "zork").

	Guy Harris