On 15 April 2010 05:49, James Paige <[email protected]> wrote: > On Wed, Apr 14, 2010 at 10:18:08AM -0700, [email protected] > wrote: >> teeemcee >> 2010-04-14 10:18:08 -0700 (Wed, 14 Apr 2010) >> 375 >> HSpeak: Fixed a large number of bugs in the constant expression optimiser, >> including: -1 was used as truth instead of 1; negative division rounded in >> wrong direction; lots of different ways to crash HSpeak such as division by >> zero; was using 31 bit instead of 32 bit integers. >> >> Also added optimisation for new math operators, and ability to optimise >> overflowing expressions. > > Awesome! I remember 32 bit integers being difficult in Euphoria, 31 bit > being the only supported int type at the time. Has it gotten any easier > in the latest euphoria?
It's the same as it's always been, and actually pretty simple. You just use atoms as 53-bit integers, and define an int32 type. > What sort of optimization do new math operators do now? I added not, logand, logor, logxor. logand and logor are deleted if their first argument is 0 or 1 respectively. There are more optimisations that could be done such as if(not(A)) then(B) else(C) => if(A) then(C) else(B). Originally I was worried about transformations like that being confusing when trying to debug scripts, but the stepping features of the script debugger are effectively scrapped, and error line number reporting won't be confused, so I'll proceed. > What is overflow optimization? If a constant expression overflows a 32 bit int, HSpeak will still optimise it to its overflowed value, eg. 2^31 => -2147483648 > --- > James > _______________________________________________ > Ohrrpgce mailing list > [email protected] > http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org > _______________________________________________ Ohrrpgce mailing list [email protected] http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
