Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: question about changing my data structure

Author: Gerd Isenberg

Date: 03:43:30 07/17/03

Go up one level in this thread


On July 17, 2003 at 06:28:44, Uri Blass wrote:

>On July 17, 2003 at 06:14:04, Richard Pijl wrote:
>
>>On July 17, 2003 at 05:58:39, Gerd Isenberg wrote:
>>
>>>On July 17, 2003 at 05:06:16, Uri Blass wrote:
>>>
>>>>Note that the name of the arrays that I have is different but I replaced the
>>>>names to make it easy to understand the problem.
>>>>
>>>>I have an array A[64][8]
>>>>
>>>>I want to replace it by 8 arrays A0[64],A1[64],...A7[64] when A[i][j]=Aj[i]
>>>
>>>Hi Uri,
>>>
>>>I would suggest A[8][64] for your purpose.
>>>
>>>Then you still may index the arrays with A[j][sq] and you get your suggested
>>>single 64 element arrays: A0[sq], A1[sq] with A[0][sq], A[1][sq] ...
>>>
>>>Gerd
>>
>>Of course! Let the compiler do the optimizing. I guess most compilers will
>>recognize this?
>>Richard.
>
>Your suggestion seems to be better.
>
>The point is that I have significant names instead of A0,A1,.... and I do not
>want to lose the significant names.
>
>I only wrote here A0, A1 to explain the point because otherwise I cannot use a
>simple formula based on the name of the array.
>
>I already finished the replace of the array and I now only need to add your
>definitions and save calculations that are done twice for both arrays.
>
>The arrays practically are not the same but every time that I call A[i][j] it is
>the same as Ai[j], so it is a waste of time to calculate A[i][j]

Uri, if "i" is a constant, there is no waste of time!
A1[j] or A[1][j] produce the same assembler output.
A[1] is a constant address expression as A1 is.
But if you don't need to inner index your A0..A7, it is Ok of course.

Gerd


>and I can have
>A[8][64] only in the definitions and never use it in the program and continue to
>use the original names that I have instead of A0...A7 thanks to your post.
>
>Uri



This page took 0.01 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.