Author: Ulrich Tuerke
Date: 05:27:03 07/18/03
Go up one level in this thread
On July 17, 2003 at 06:43:30, Gerd Isenberg wrote: >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. This in fact depends on the compiler implementation. The good old TurboC had to generate a few additional code lines in case of double indexed arrays. Regarding, the 32 Bit compiler by MS you are of course right, Gerd; there is no performance penalty in this case. May be, this is a pedantic remark of mine. -:) Uli >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 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.