[Freeciv-Dev] Re: [PATCH] is_normal_tile function
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Perhaps we should have a macro
#define RANGE_CHECK (p1, p2) ((unsigned)(p1) < (unsigned)(p2))
Then the code would be
return RANGE_CHECK(y, map.ysize) && RANGE_CHECK(x, map.xsize);
Although this doesn't really tell the reader that y is checked
against map size.
Best Regards,
Roy Tate
P.S. I am separately posting a short introduction
--- Trent Piepho <xyzzy@xxxxxxxxxxxxx> wrote:
> On Wed, 15 Aug 2001, Raimar Falke wrote:
>>> you might want to use Ross' geeky way of writing such
things:
>>>
>>> return ((unsigned) y < (unsigned) map.ysize) && (....)
>>>
>>> or am I as usual missing something?
>>
>> It is interesting to see that even a simple function can be
>> obfuscated.
>
> But it's faster! I like it when I see clever optimizations
> that I wouldn't have thought of myself. I wonder what would
> happen to if tried to compile that on some old 70s computer
> that didn't use twos compliment?
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/
- [Freeciv-Dev] Re: [PATCH] is_normal_tile function, (continued)
- [Freeciv-Dev] Re: [PATCH] is_normal_tile function, Gregory Berkolaiko, 2001/08/15
- [Freeciv-Dev] Re: [PATCH] is_normal_tile function, Raimar Falke, 2001/08/15
- [Freeciv-Dev] Re: [PATCH] is_normal_tile function, Gregory Berkolaiko, 2001/08/15
- [Freeciv-Dev] Re: [PATCH] is_normal_tile function, Raimar Falke, 2001/08/15
- [Freeciv-Dev] Re: [PATCH] is_normal_tile function, Gaute B Strokkenes, 2001/08/15
- [Freeciv-Dev] Re: [PATCH] is_normal_tile function, Gregory Berkolaiko, 2001/08/16
- [Freeciv-Dev] Re: [PATCH] is_normal_tile function, Ross W. Wetmore, 2001/08/16
- [Freeciv-Dev] Re: [PATCH] is_normal_tile function, Trent Piepho, 2001/08/15
- [Freeciv-Dev] Re: [PATCH] is_normal_tile function, Tony Stuckey, 2001/08/15
- [Freeciv-Dev] Re: [PATCH] is_normal_tile function, Miguel Farah F., 2001/08/15
- [Freeciv-Dev] Re: [PATCH] is_normal_tile function,
Roy Tate <=
- [Freeciv-Dev] Re: [PATCH] is_normal_tile function, Raimar Falke, 2001/08/16
- [Freeciv-Dev] Re: [PATCH] is_normal_tile function, Ross W. Wetmore, 2001/08/16
- [Freeciv-Dev] Re: [PATCH] is_normal_tile function, Raimar Falke, 2001/08/17
- [Freeciv-Dev] Re: [PATCH] is_normal_tile function, Ross W. Wetmore, 2001/08/17
- [Freeciv-Dev] Re: [PATCH] is_normal_tile function, Raimar Falke, 2001/08/17
- [Freeciv-Dev] Re: [PATCH] is_normal_tile function, Ross W. Wetmore, 2001/08/16
- [Freeciv-Dev] Re: [PATCH] is_normal_tile function, Raimar Falke, 2001/08/17
|
|