Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2001:
[Freeciv-Dev] Re: the directional system
Home

[Freeciv-Dev] Re: the directional system

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: the directional system
From: Greg Wooledge <greg@xxxxxxxxxxxx>
Date: Fri, 7 Sep 2001 20:33:02 -0400

Raimar Falke (hawk@xxxxxxxxxxxxxxxxxxxxxxx) wrote:
> On Fri, Sep 07, 2001 at 04:51:36AM -0700, Trent Piepho wrote:
> > +#define DIR_REVERSE(dir) (((dir) + 4) % 8)
> > +#define DIR_REVERSE(dir) (((dir) + 4) & 7)

> $ gcc -S -O2 a.c
> $ cat a.s

Nice demonstration, but it only shows that your version of gcc can handle
this optimization -- there may be other compilers out there that don't.
It's safer to use the bitwise AND operation.

-- 
Greg Wooledge                  |   "Truth belongs to everybody."
greg@xxxxxxxxxxxx              |    - The Red Hot Chili Peppers
http://wooledge.org/~greg/     |

Attachment: pgp7_suFZAeN1.pgp
Description: PGP signature


[Prev in Thread] Current Thread [Next in Thread]