Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: question about changing my data structure

Author: Ulrich Tuerke

Date: 08:18:29 07/18/03

Go up one level in this thread


On July 18, 2003 at 09:17:51, Gerd Isenberg wrote:

>>>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
>>
>
>Hi Uli,
>
>he,he, the good old TurboC.
>Was TurboC not able to calc some constant address expressions?
>What about constant int expressions like
>
> i = (5*(1<<4));-)

No, this was perfect.

I think that the problem had been caused by lesser options in the use of index
registers in the older 16 Bit assembler.
A current compiler (MS) generates

; k = a[3][j-1];
	mov	eax, DWORD PTR _j$[ebp]
	mov	ecx, DWORD PTR _a$[ebp+eax*4+44]
	mov	DWORD PTR _k$[ebp], ecx
; l = a3[j-1];
	mov	edx, DWORD PTR _j$[ebp]
	mov	eax, DWORD PTR _a3$[ebp+edx*4-4]
	mov	DWORD PTR _l$[ebp], eax

IIRC, the old assembler hadn't support expressions like [ebp+eax*4+44]
when indexing. You had a special index register which had to be used like [di]
The register di had to be prepared before by multiplying and offsetting, iirc.

But it's a long time ago and I have never been an assembler expert. May be you
know better ?

have a nice weekend,
Uli


>
>Regards,
>Gerd



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.