mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
When optimizing nonconst * const, cast the result to the type of the operator.
Per bug report by @Welcius. Fixes #8.
This commit is contained in:
parent
750465f17b
commit
1bdaff32ab
5 changed files with 46 additions and 5 deletions
14
unit_tests/regression.suite/issue-8.lsl
Normal file
14
unit_tests/regression.suite/issue-8.lsl
Normal file
|
@ -0,0 +1,14 @@
|
|||
default{timer(){
|
||||
|
||||
integer x = llGetNumberOfPrims();
|
||||
integer y = llGetUnixTime();
|
||||
llOwnerSay((string)(x * 1.0 / y));
|
||||
llOwnerSay((string)(x / 1.0 / y));
|
||||
llOwnerSay((string)(x / (-1.0) / y));
|
||||
llOwnerSay((string)(x * 1.0 / y));
|
||||
llOwnerSay((string)(x * (-1.0) / y));
|
||||
llOwnerSay((string)(x * -2.0));
|
||||
llOwnerSay((string)(x * 0.0 + y));
|
||||
llOwnerSay((string)(x + 0.0 + y));
|
||||
|
||||
}}
|
16
unit_tests/regression.suite/issue-8.out
Normal file
16
unit_tests/regression.suite/issue-8.out
Normal file
|
@ -0,0 +1,16 @@
|
|||
default
|
||||
{
|
||||
timer()
|
||||
{
|
||||
integer x = llGetNumberOfPrims();
|
||||
integer y = llGetUnixTime();
|
||||
llOwnerSay((string)((float)x / y));
|
||||
llOwnerSay((string)((float)x / y));
|
||||
llOwnerSay((string)(-(float)x / y));
|
||||
llOwnerSay((string)((float)x / y));
|
||||
llOwnerSay((string)(-(float)x / y));
|
||||
llOwnerSay((string)(-(x + (float)x)));
|
||||
llOwnerSay((string)((float)y));
|
||||
llOwnerSay((string)((float)x + y));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue