[Freeciv-Dev] Re: [PATCH] is_normal_tile function
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
At 11:41 AM 01/08/17 +0200, Raimar Falke wrote:
>On Thu, Aug 16, 2001 at 08:15:04PM -0400, Ross W. Wetmore wrote:
>> At 09:32 AM 01/08/16 +0200, Raimar Falke wrote:
[...]
>> I know you hate this, but if you look at most machine instruction sets
>> they have indexing operations that are perverted into 3-way adds by gcc
>> and other compilers. So, ...
[...]
>> This also means that when people cleanup map.xsize-1 they are usually
>> wasting their time :-).
>
>I don't understand this one.
In 386 assembler, the instruction is LEA disp(index,base). But the
equivalent exists on most other platforms because hardware indexed array
operations are a big payoff.
Compilers fold constants into the disp field, and can add an index to a
base as well. This means x - (map.xsize-1) is LEA 1(-map.xsize,x) with the
condition set for the branch. Or something like this ...
Constant additions or subtractions from a base value as are typical in most
array index computations are very fast single instructions. So you
shouldn't worry about a few being used in any computation as the compiler
will find them.
Cheers,
RossW
> Raimar
>
>--
> email: rf13@xxxxxxxxxxxxxxxxx
>
- [Freeciv-Dev] Re: [PATCH] is_normal_tile function, (continued)
- [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, 2001/08/15
- [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 <=
- [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
|
|