Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved expression simplification + more unit tests
- Loading branch information
Brad Robinson
committed
Aug 5, 2010
1 parent
9249cb1
commit 28a5803
Showing
4 changed files
with
158 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
// [Formatted][NoObfuscate] | ||
var x; | ||
x=a+b+c; | ||
x=a*b+c; | ||
x=a*(b+c); | ||
x=a/b+c; | ||
x=a/(b+c); | ||
x=a%b+c; | ||
x=a%(b+c); | ||
x=a*b-c; | ||
x=a*(b-c); | ||
x=a/b-c; | ||
x=a/(b-c); | ||
x=a%b-c; | ||
x=a%(b-c); | ||
x=a+(b*c); | ||
x=a-(b*c); | ||
x=a+(b/c); | ||
x=a-(b/c); | ||
x=a+(b%c); | ||
x=a-(b%c); | ||
x=a-d*(b%c); | ||
x=a-d/(b%c); | ||
x=a<<b>>c; | ||
x=a<<b>>>c; | ||
x=a>>b<<c; | ||
x=a>>>b<<c; | ||
x=a<<(b>>c); | ||
x=a<<(b>>>c); | ||
x=a>>(b<<c); | ||
x=a>>>(b<<c); | ||
x=a||b&&c; | ||
x=(a||b)&&c; | ||
x=a||(b&&c); | ||
x=a|b&c; | ||
x=(a|b)&c; | ||
x=a|(b&c); | ||
x=a|b^c; | ||
x=(a|b)^c; | ||
x=a|(b^c); | ||
----- | ||
var x; | ||
x=a+b+c; | ||
x=a*b+c; | ||
x=a*(b+c); | ||
x=a/b+c; | ||
x=a/(b+c); | ||
x=a%b+c; | ||
x=a%(b+c); | ||
x=a*b-c; | ||
x=a*(b-c); | ||
x=a/b-c; | ||
x=a/(b-c); | ||
x=a%b-c; | ||
x=a%(b-c); | ||
x=a+b*c; | ||
x=a-b*c; | ||
x=a+b/c; | ||
x=a-b/c; | ||
x=a+b%c; | ||
x=a-b%c; | ||
x=a-d*(b%c); | ||
x=a-d/(b%c); | ||
x=a<<b>>c; | ||
x=a<<b>>>c; | ||
x=a>>b<<c; | ||
x=a>>>b<<c; | ||
x=a<<(b>>c); | ||
x=a<<(b>>>c); | ||
x=a>>(b<<c); | ||
x=a>>>(b<<c); | ||
x=a||b&&c; | ||
x=(a||b)&&c; | ||
x=a||b&&c; | ||
x=a|b&c; | ||
x=(a|b)&c; | ||
x=a|b&c; | ||
x=a|b^c; | ||
x=(a|b)^c; | ||
x=a|b^c; | ||
----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// [Formatted][NoObfuscate] | ||
var x; | ||
x=a+b+c; | ||
x=a+(b+c); | ||
x=a-(b+c); | ||
x=(a-b)+c; | ||
x=(a-b)-(c-d); | ||
x=a+-1; | ||
x=a-(-b+c); | ||
----- | ||
var x; | ||
x=a+b+c; | ||
x=a+b+c; | ||
x=a-b-c; | ||
x=a-b+c; | ||
x=a-b-c+d; | ||
x=a-1; | ||
x=a+b-c; | ||
----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// [Formatted][NoObfuscate] | ||
var x; | ||
x=a*b*c; | ||
x=a*(b*c); // Parens can be removed | ||
x=-a*-b; // Negative * negative = positive | ||
x=-a*-b*-c; // Triple negative = single negative | ||
x=a/(b*c); // This should stay as is. We don't optimize division of nested terms. | ||
x=a/(b/c); // Same here. | ||
x=a*(b%c); // Never optimize modulus | ||
x=a*(b*c%d); | ||
x=a*(b/c); | ||
x=a*(b/(c%d)); | ||
x=a*(b%c*d); | ||
x=a*(b%c*d/e); | ||
----- | ||
var x; | ||
x=a*b*c; | ||
x=a*b*c; | ||
x=a*b; | ||
x=-a*b*c; | ||
x=a/(b*c); | ||
x=a/(b/c); | ||
x=a*(b%c); | ||
x=a*(b*c%d); | ||
x=a*b/c; | ||
x=a*b/(c%d); | ||
x=a*(b%c)*d; | ||
x=a*(b%c)*d/e; | ||
----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// [Formatted][NoObfuscate] | ||
x=-a; | ||
x=+a; | ||
x=+(a-b); | ||
x=-(-a); | ||
x=+(-a); | ||
x=-(+a); | ||
x=+(+a); | ||
x=-(a+b); | ||
x=-(a-b); | ||
x=-(-a+b); | ||
x=-(-a-b); | ||
x=-(a*b); | ||
x=-(a*-b); | ||
----- | ||
x=-a; | ||
x=a; | ||
x=a-b; | ||
x=a; | ||
x=-a; | ||
x=-a; | ||
x=a; | ||
x=-a-b; | ||
x=-a+b; | ||
x=a-b; | ||
x=a+b; | ||
x=-a*b; | ||
x=a*b; | ||
----- |