Register | Login
Forum Index > Requests and Feedback > for with var parametr
Author Message
Pages: 1
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[712] for with var parametr - posted: 2011-11-16 18:25:56

hi i want for allow this
Code:
   int32 i;
   for(i =0 to indx)
    {
       IntToStr(indx,@tmp);
       edx = @right; eax = i; imul  eax,255; add eax , Edx; 
       H_strjoin(@buf, 'byte ' , @var, '[' , @tmp ,']=' , eax , ';' );
       Ziron_ShowMessage(@buf);
    } 


BTW C++ allow this , declare variable inside 'for' block
Code:
 for(int i=0; i<100; i++)
  {
   } 


http://www.freewebs.com/ogremagic/index.htm
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[713] - posted: 2011-11-16 19:06:06

also i need ziron allows that
Code:
 add eax , @right; // @right is a pointer


http://www.freewebs.com/ogremagic/index.htm
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[715] - posted: 2011-11-16 21:51:34
i will add it, but i should note that a variable inside a for loop is extremely slow.

a better way would be to use registers as often as possible like so:
Code:
   push edi
   push esi
   esi = indx;
   for(edi = 0 to esi) { //cmp of registers is much faster
       IntToStr(esi,@tmp);
       edx = @right; eax = edi; imul eax,255; add eax, edx; 
       H_strjoin(@buf, 'byte ' , @var, '[' , @tmp ,']=' , eax , ';' );
       Ziron_ShowMessage(@buf);
   } 
   pop esi
   pop edi


Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Pages: 1
create new reply


Quick reply:

Message:



Currently Active Users:
There are currently 14 user(s) online. 0 member(s) and 14 guest(s)
Most users ever online was 1046, January 28, 2022, 2:08 pm.


Statistics:
Threads: 225 | Posts: 1848 | Members: 51 | Active Members: 51
Welcome to our newest member, yecate
const Copyright = '2011-2024 © OverHertz Ltd. All rights reserved.';
Web development by OverHertz Ltd