| [Freeciv-Dev] Re: directional system: more magic code cleanups[Top] [All Lists][Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
 
 On Thu, Sep 20, 2001 at 08:29:12PM -0400, Ross W. Wetmore wrote:
> At 10:46 AM 01/09/20 +0200, Raimar Falke wrote:
> >On Tue, Sep 18, 2001 at 11:57:06PM -0400, Ross W. Wetmore wrote:
> >> Attached is a copy of straightest_dir with yet another explanation 
> >> of the algorithm embedded as comments in hopes that repetition will
> >> eventually penetrate those that still haven't got it :-).
> >> 
> >> Note that to choose one of 8 directions, the absolute minimum work
> >> is 3 binary compares, so there is still room for improvement in the
> >> attached algorithm.
> >
> >[ The following mail is off topic and a negative example that you can
> >optimize too much. It just shows that I like a good problem. ]
> >
> >The fastest version I can think of goes like this:
> 
> Unfortunately, I think the corecleanup algorithm actually had fewer 
> instructions, certainly compares, and no multiplication or division, 
> plus it was more general.
> 
> It is also better to put the Direction enums in an easily replaceable
> array, than to hardcode them into code.
> 
> But at least this is an O(0) solution instead of the fully fledged
> O(n) one you started with.
> 
> We are getting there! even if by process of elimination :-)
If you make a benchmark of Jason's scalar product method (float and
sqrt), my scalar product method (int), my int tan(pi/8) method and
your bit method AND check that each method returns the same value I
will consider this. If you (or somebody) else will do this I will
apply my int scalar product method tomorrow.
        Raimar
-- 
 email: rf13@xxxxxxxxxxxxxxxxx
  "With a PC, I always felt limited by the software available.
   On Unix, I am limited by my knowledge."
    -- Peter J. Schoenster <pschon@xxxxxxxxxxxxxxxxx>
 
[Freeciv-Dev] Re: directional system: more magic code cleanups, (continued)
[Freeciv-Dev] Re: directional system: more magic code cleanups, Raimar Falke, 2001/09/18
[Freeciv-Dev] Re: directional system: more magic code cleanups, Jason Dorje Short, 2001/09/18
[Freeciv-Dev] Re: directional system: more magic code  cleanups, Ross W. Wetmore, 2001/09/18
[Freeciv-Dev] Re: directional system: more magic code cleanups, Ross W. Wetmore, 2001/09/18
[Freeciv-Dev] Re: directional system: more magic code cleanups, Raimar Falke, 2001/09/19
[Freeciv-Dev] Re: directional system: more magic code cleanups, Raimar Falke, 2001/09/20
[Freeciv-Dev] Re: directional system: more magic code  cleanups, Ross W. Wetmore, 2001/09/20
[Freeciv-Dev] Re: directional system: more magic code cleanups,
Raimar Falke <=
[Freeciv-Dev] Re: directional system: more magic code  cleanups, Ross W. Wetmore, 2001/09/21
[Freeciv-Dev] Re: directional system: more magic code cleanups, Raimar Falke, 2001/09/23
[Freeciv-Dev] Re: directional system: more magic code  cleanups, Ross W. Wetmore, 2001/09/24
[Freeciv-Dev] Re: directional system: more magic code cleanups, Raimar Falke, 2001/09/24
[Freeciv-Dev] Re: directional system: more magic code  cleanups, Ross W. Wetmore, 2001/09/25
[Freeciv-Dev] Re: directional system: more magic code cleanups, Raimar Falke, 2001/09/25
[Freeciv-Dev] Re: directional system: more magic code cleanups, Gregory Berkolaiko, 2001/09/25
[Freeciv-Dev] Re: directional system: more magic code cleanups, Raimar Falke, 2001/09/25
[Freeciv-Dev] Re: directional system: more magic code  cleanups, Ross W. Wetmore, 2001/09/26
[Freeciv-Dev] Re: directional system: more magic code  cleanups, Ross W. Wetmore, 2001/09/25
 
 |  |