[OK]Constant folding efficiency.

Post your requests and ideas on the future development of mikroPascal.
Post Reply
Author
Message
Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

[OK]Constant folding efficiency.

#1 Post by Dany » 27 Jul 2008 09:13

Hi,

Only for your info:

Apparently this code is compiled more efficient (less rom)

Code: Select all

const __HexOffset = Ord('A') - 10;
...
Tmp := Tmp + __HexOffset;
than this one:

Code: Select all

Tmp := Tmp + Ord('A') - 10;


Declaring "Ord('A') - 10" as an actual constant does the constant folding, using "Ord('A') - 10" directly in the code does not perform constant folding. Observed in the assembly code.

MicroPascal version 8.0.0.1, PIC = 16F628A.
Last edited by Dany on 20 Apr 2009 15:03, edited 2 times in total.
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

#2 Post by yo2lio » 27 Jul 2008 12:03

Try this :

Code: Select all

Tmp := Tmp + (Ord('A') - 10);
:wink:
Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

#3 Post by Dany » 27 Jul 2008 15:55

Great. Thanks. :D
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

Post Reply

Return to “mikroPascal Wish List”