[m-rev.] diff: avoid stack overflow

Peter Moulder pmoulder at mail.csse.monash.edu.au
Sat May 17 15:24:59 AEST 2003


On Sat, May 17, 2003 at 01:22:28PM +1000, Zoltan Somogyi wrote:

> -	( { CurIndex mod 16 = 0 } ->
> +	( { CurIndex mod 10 = 0 } ->

A micro-optimisation would be s/mod/rem/.

For `= 0', this doesn't even require knowing that CurIndex >= 0,
so one might hope that the compiler would do this.

(I sometimes think that the purpose of optimization passes is not to
make code faster but to save the programmer from thinking about it.)

Just looking at int.m.  Are we allowed to assume two's complement?
If not then odd,even are wrong.  Probably the right fix is just
to add test cases (cf. the comment for the `>>' definition above
odd,even definitions).

pjm.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list