LSL-PyOptimizer/lslopt
Sei Lisa 4ba71993a4 Optimize min/max in comparisons; undo problematic optimization.
For floats:

When const >= function.max, comparisons of function > const always yield FALSE.

When const <  function.min, comparisons of function > const always yield TRUE.

When const >  function.max, comparisons of function < const always yield TRUE.

When const <= function.min, comparisons of function < const always yield FALSE.

For integers:

When min = -1, cond(function > -1) is the same as cond(!~function).

When min = -1, cond(function < 0) is the same as cond(~function).

To implement the above, we got rid of the cond(x < 0)  ->  cond(x & 0x80000000) optimization, which has caused more trouble than it has solved for just 1 byte gain.

When min = 0, cond(function > 0) is the same as cond(function).

When min = 0, cond(function < 1) is the same as cond(!function).

Similar expressions can be obtained for max in [-1, 0], but it's not worth it, as there are no functions with -1 as maximum, and the ones with max=0 also have min=0 (always return 0).
2017-10-26 00:58:14 +02:00
..
__init__.py Initial commit. Status so far: 2014-07-26 02:43:44 +02:00
lslbasefuncs.py Fix compare and llListSort for LSO. 2017-10-21 12:32:41 +02:00
lslcommon.py Internal code reorganization. 2017-10-20 18:19:48 +02:00
lsldeadcode.py Fix crash when variables appear inside global lists. 2017-10-16 02:22:52 +02:00
lslextrafuncs.py Add llGetStatus to lslextrafuncs. 2017-10-20 09:58:49 +02:00
lslfoldconst.py Optimize min/max in comparisons; undo problematic optimization. 2017-10-26 00:58:14 +02:00
lslfuncopt.py Comment fix. 2017-10-20 10:18:44 +02:00
lslfuncs.py Bump copyright year. 2017-08-09 19:45:46 +02:00
lsljson.py Change strategy for the checking of function input types. 2017-10-12 17:16:16 +02:00
lsllastpass.py Minor cleanups; no functional changes. 2017-09-22 15:42:42 +02:00
lslloadlib.py Add side-effect-free information for events. 2017-10-25 17:46:50 +02:00
lsloptimizer.py Implement transformation of lists into additions. 2017-09-15 22:30:22 +02:00
lsloutput.py Internal code reorganization. 2017-10-20 18:19:48 +02:00
lslparse.py Add side-effect-free information for events. 2017-10-25 17:46:50 +02:00
lslrenamer.py Add TODO item to lslrenamer. 2017-08-16 22:00:16 +02:00