[Freeciv-Dev] Re: [Patch] Small patch
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Sun, Feb 10, 2002 at 06:49:10PM +0000, Gregory Berkolaiko wrote:
> --- Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> [...]
> > \
> > int ARG_x_itr, ARG_y_itr;
> > \
> > int MACRO_max_dx = map.xsize/2;
> > \
> > - int MACRO_min_dx = -(MACRO_max_dx - (map.xsize%2 ? 0 : 1));
> > \
> > + int MACRO_min_dx = -MACRO_max_dx - 1 + (map.xsize % 2);
>
> performance issue: are you sure (map.xsize%2 ? 0 : 1) gets optimized?
No it doesn't. As I said: we can remove one jump.
> or maybe we can write (map.xsize & 1) to make sure about it?
signed int x;
unsigned int y;
"x%2" is
movl %edx, %eax
shrl $31, %eax
leal (%eax,%edx), %eax
andl $-2, %eax
subl %eax, %edx
while "y%2", "x&1" and "y&1" is
andl $1, %eax
So yes this may be optimized further.
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
"Sit, disk, sit. Good boy. Now spin up. Very good. Here's a netscape
cookie for you. Fetch me some data. Come on, you can do it. No, not that
data. Bad disk. Bad."
-- Calle Dybedahl, alt.sysadmin.recovery
|
|