Article View: sci.image.processing
Article #338Re: image processing loops: a c programming question
From: S.P.Zeidler
Date: Wed, 26 Aug 1992 16:20
Date: Wed, 26 Aug 1992 16:20
36 lines
1861 bytes
1861 bytes
In <1992Aug13.193434.660@bmw.mayo.edu> elw@jaguar.sky2 (Ellis Workman, 1-157 Med Sci, 4-4435) writes:
>In article 713717257@isy, stefang@isy.liu.se (Stefan Gustavson) writes:
>>Or if you don't care which row you are on, you could just write:
>> for(dp=data; dp<xsize*ysize*sizeof(int); *dp++= ...)
> DO YOU REALLY WANT TO DO THE
> xsize*ysize*sizeof(int)
> (compute byte count)
> ON EVERY ITERATION OF THE LOOP??????
>how about
> for(i=xsize*ysize, dp = data;i;i--)
> *dp++ = ...;
Uhmn, that would not be the greatest problem regarding that code;
probably intended was:
{
int xsize, ysize;
int data[ysize][xsize], *dp, *dpmax;
for (dp=data, dpmax=data+xsize*ysize; dp<dpmax; dp++) *dp = foobar+stuff;
/* I like to do the increment in the for () 'cause that ensures
defined behaviour with nested if() in the loop and generally
reads better (IMHO) */
}
Note the absence of the sizeof and the presence of data in the
max-data-ptr you check against.
Sorry if that followup strikes you as a bit late; we are still lagging
a lot, but it's getting better ;-)
regards,
spz
--
spz is S.Petra Zeidler Copyright 1992 S.Petra Zeidler
spz@specklec.mpifr-bonn.mpg.de
MPI fuer Radioastronomie Bonn
Auf dem Huegel 69, Germany reading prescription: cum kilo salis
Technical Details
Message-ID:
<1992Aug26.162058.1633@mpifr-bonn.mpg.de>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!Germany.EU.net!mpifr-bonn.mpg.de!specklec.mpifr-bonn.mpg.de!spzReferences:
<stefang.713717257@isy> <1992Aug13.193434.660@bmw.mayo.edu>Show Full Headers
Complete Article Headers
Newsgroups: sci.image.processing Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!Germany.EU.net!mpifr-bonn.mpg.de!specklec.mpifr-bonn.mpg.de!spz From: spz@specklec.mpifr-bonn.mpg.de (S.P.Zeidler) Subject: Re: image processing loops: a c programming question Message-ID: <1992Aug26.162058.1633@mpifr-bonn.mpg.de> Sender: news@mpifr-bonn.mpg.de Nntp-Posting-Host: specklec Organization: Max-Planck-Institut f"ur Radioastronomie References: <stefang.713717257@isy> <1992Aug13.193434.660@bmw.mayo.edu> Date: Wed, 26 Aug 1992 16:20:58 GMT Lines: 36