Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: question about changing my data structure

Author: Richard Pijl

Date: 06:19:46 07/17/03

Go up one level in this thread


On July 17, 2003 at 08:23:37, Uri Blass wrote:

>On July 17, 2003 at 05:40:09, Richard Pijl 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]
>>>
>>>What is the best way to do it?
>>
>>elt_t A[8][64]
>>elt_t* A0;
>>elt_t* A1;
>>...
>>elt_t* A7;
>>
>>A0=&A[0][0];
>>A1=&A[1][0];
>>
>>Now you can use either A0[x] or A[0][x], which will point at the same element.
>>
>>Richard.
>
>I tried it and I found that the code is slower.
>
>I wonder if the compiler can take advantage of knowing the fact that A0 is an
>array of 64 elements in the original case when after the modification that you
>suggest it cannot know it.
>

My guess is that defining A0 and so on as constant pointers might improve the
situation. Otherwise: Gerd ? :-)

Richard.

>Uri



This page took 0 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.