Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > multi dimensional array example

Reply
Thread Tools

multi dimensional array example

 
 
Skybuck Flying
Guest
Posts: n/a
 
      11-29-2006
> Try accessing the arrays in the same order. Your C program is varying

Oh sorry, I was in a hurry..

I should have posted the worst case code.. instead of the best case code..

Well nothing a new post can't fix... here is the worst case delphi version:

Project1.dpr.350: begin
00409CEC 55 push ebp
00409CED 8BEC mov ebp,esp
00409CEF 83C4D8 add esp,-$28
00409CF2 53 push ebx
00409CF3 33C0 xor eax,eax
00409CF5 8945FC mov [ebp-$04],eax
00409CF8 33C0 xor eax,eax
00409CFA 55 push ebp
00409CFB 68DE9D4000 push $00409dde
00409D00 64FF30 push dword ptr fs:[eax]
00409D03 648920 mov fs:[eax],esp
Project1.dpr.353: SetLength( vArray, 200, 200, 200 );
00409D06 68C8000000 push $000000c8
00409D0B 68C8000000 push $000000c8
00409D10 68C8000000 push $000000c8
00409D15 8D45FC lea eax,[ebp-$04]
00409D18 B903000000 mov ecx,$00000003
00409D1D 8B15B49C4000 mov edx,[$00409cb4]
00409D23 E888B4FFFF call @DynArraySetLength
00409D28 83C40C add esp,$0c
Project1.dpr.355: vLongTick1 := GetTickCount;
00409D2B E800C0FFFF call GetTickCount
00409D30 33D2 xor edx,edx
00409D32 8945E8 mov [ebp-$18],eax
00409D35 8955EC mov [ebp-$14],edx
Project1.dpr.359: for x := 0 to 199 do
00409D38 33C9 xor ecx,ecx
Project1.dpr.361: for y := 0 to 199 do
00409D3A 33D2 xor edx,edx
Project1.dpr.363: for z := 0 to 199 do
00409D3C 33C0 xor eax,eax
Project1.dpr.365: vArray[ z, x, y ] := 123456789;
00409D3E 8B5DFC mov ebx,[ebp-$04]
00409D41 8B1C83 mov ebx,[ebx+eax*4]
00409D44 8B1C8B mov ebx,[ebx+ecx*4]
00409D47 C7049315CD5B07 mov [ebx+edx*4],$075bcd15
Project1.dpr.366: end;
00409D4E 40 inc eax
Project1.dpr.363: for z := 0 to 199 do
00409D4F 3DC8000000 cmp eax,$000000c8
00409D54 75E8 jnz $00409d3e
Project1.dpr.367: end;
00409D56 42 inc edx
Project1.dpr.361: for y := 0 to 199 do
00409D57 81FAC8000000 cmp edx,$000000c8
00409D5D 75DD jnz $00409d3c
Project1.dpr.368: end;
00409D5F 41 inc ecx
Project1.dpr.359: for x := 0 to 199 do
00409D60 81F9C8000000 cmp ecx,$000000c8
00409D66 75D2 jnz $00409d3a
Project1.dpr.370: vLongTick2 := GetTickCount;
00409D68 E8C3BFFFFF call GetTickCount
00409D6D 33D2 xor edx,edx
00409D6F 8945E0 mov [ebp-$20],eax
00409D72 8955E4 mov [ebp-$1c],edx
Project1.dpr.373: if vLongTick2 < vLongTick1 then
00409D75 8B45E0 mov eax,[ebp-$20]
00409D78 8B55E4 mov edx,[ebp-$1c]
00409D7B 3B55EC cmp edx,[ebp-$14]
00409D7E 7507 jnz $00409d87
00409D80 3B45E8 cmp eax,[ebp-$18]
00409D83 7311 jnb $00409d96
00409D85 EB02 jmp $00409d89
00409D87 7D0D jnl $00409d96
Project1.dpr.375: vLongTick2 := vLongTick2 + 4294967296;
00409D89 8B45E0 mov eax,[ebp-$20]
00409D8C 8B55E4 mov edx,[ebp-$1c]
00409D8F 42 inc edx
00409D90 8945E0 mov [ebp-$20],eax
00409D93 8955E4 mov [ebp-$1c],edx
Project1.dpr.380: vInterval := vLongTick2 - vLongTick1;
00409D96 8B45E0 mov eax,[ebp-$20]
00409D99 8B55E4 mov edx,[ebp-$1c]
00409D9C 2B45E8 sub eax,[ebp-$18]
00409D9F 1B55EC sbb edx,[ebp-$14]
00409DA2 8945D8 mov [ebp-$28],eax
00409DA5 8955DC mov [ebp-$24],edx
Project1.dpr.383: vArray := nil;
00409DA8 8D45FC lea eax,[ebp-$04]
00409DAB 8B15B49C4000 mov edx,[$00409cb4]
00409DB1 E806B4FFFF call @DynArrayClear
Project1.dpr.386: result := vInterval;
00409DB6 8B45D8 mov eax,[ebp-$28]
00409DB9 8945F0 mov [ebp-$10],eax
00409DBC 8B45DC mov eax,[ebp-$24]
00409DBF 8945F4 mov [ebp-$0c],eax
Project1.dpr.387: end;
00409DC2 33C0 xor eax,eax

Admire, be dazzled and witness the Delphi goodness * =D WIE.

Bye,
Skybuck





 
Reply With Quote
 
 
 
 
robertwessel2@yahoo.com
Guest
Posts: n/a
 
      11-29-2006

Skybuck Flying wrote:
> > Try accessing the arrays in the same order. Your C program is varying

>
> Oh sorry, I was in a hurry..
>
> I should have posted the worst case code.. instead of the best case code..
>
> Well nothing a new post can't fix... here is the worst case delphi version:



And the point of this post is? Are there some results of significance?


> Project1.dpr.350: begin
> (...)
> Admire, be dazzled and witness the Delphi goodness * =D WIE.



Not likely.

 
Reply With Quote
 
 
 
 
Alex Buell
Guest
Posts: n/a
 
      11-29-2006
On 29 Nov 2006 12:17:53 -0800, I waved a wand and this message
magically appears in front of http://www.velocityreviews.com/forums/(E-Mail Removed):

> And the point of this post is? Are there some results of
> significance?


He's a Pascal zealot. But he does have a valid point; Pascal can
generate highly optimised code. I remember the old TurboPascal days.

However, C++'s far more interesting to code with...

> > Project1.dpr.350: begin
> > (...)
> > Admire, be dazzled and witness the Delphi goodness * =D WIE.

>
> Not likely.


Delpi? Ugh. Bloatware compared to TurboPascal.
--
http://www.munted.org.uk

You've been eating the cat food again, haven't you?
 
Reply With Quote
 
Jim P
Guest
Posts: n/a
 
      11-30-2006
Mark McIntyre wrote:
> On Fri, 24 Nov 2006 10:34:53 +0000, in comp.lang.c , Richard
> Heathfield <(E-Mail Removed)> wrote:
>
>
>>Skybuck Flying said:
>>
>>
>>>Hello,
>>>
>>>How to convert this Delphi code for Win32 to C or C++ Win32 code ?

>>
>>You could start by apologising for your systematic and prolonged Usenet
>>abuse over several years. People aren't usually all that interested in
>>helping trolls with technical problems.

>
>
> Richard,
>

and I second that motion

Skybuck is just after causing issues and effects and will push anything
to the limit - - like he tried with me a few months ago

and that made a total fool of himself - - trying and trying to prove his
idea had some worth - -

and got more crazy in his responses to try to prove it - - -

best to just let him go and not get the response that he wants.

and that is any response at all - - including even this one

Jim P.
 
Reply With Quote
 
Skybuck Flying
Guest
Posts: n/a
 
      11-30-2006

"Jim P" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Mark McIntyre wrote:
>> On Fri, 24 Nov 2006 10:34:53 +0000, in comp.lang.c , Richard
>> Heathfield <(E-Mail Removed)> wrote:
>>
>>
>>>Skybuck Flying said:
>>>
>>>
>>>>Hello,
>>>>
>>>>How to convert this Delphi code for Win32 to C or C++ Win32 code ?
>>>
>>>You could start by apologising for your systematic and prolonged Usenet
>>>abuse over several years. People aren't usually all that interested in
>>>helping trolls with technical problems.

>>
>>
>> Richard,

> and I second that motion
>
> Skybuck is just after causing issues and effects and will push anything to
> the limit - - like he tried with me a few months ago
>
> and that made a total fool of himself - - trying and trying to prove his
> idea had some worth - -
>
> and got more crazy in his responses to try to prove it - - -
>
> best to just let him go and not get the response that he wants.
>
> and that is any response at all - - including even this one


Try alt.nag.newsgroup.

Bye,
Skybuck.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
To convert a one dimensional array into a two dimensional array using C amrutha0303 Software 0 08-03-2010 10:02 PM
multi-dimensional arrays to 2-dimensional arrays Wirianto Djunaidi Ruby 2 04-29-2008 07:31 AM
multi dimensional array example Skybuck Flying C Programming 44 11-30-2006 05:24 AM
Multi-dimensional Array in Java? kk_oop Java 1 07-24-2004 11:23 PM
How do copy Strings from a single dimensional array to double dimensional array Venkat C++ 4 12-05-2003 09:23 AM



Advertisments