aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-11-02 16:05:47 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-11-02 16:05:47 -0700
commit09de22204dd577ecfccb2c2011ad3b26d6f37f00 (patch)
tree472ba0b0c3609a28574dd4a6711656bf1de03568
parent2cb4f619236d03732f0db10a6a126af84bbae805 (diff)
commented out refactoring of makeRounding
-rw-r--r--src/parseTools.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/parseTools.js b/src/parseTools.js
index 8e919d15..5d7420ef 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -1566,6 +1566,19 @@ function makeRounding(value, bits, signed, floatConversion) {
// been rounded properly regardless, and we will be sign-corrected later when actually used, if
// necessary.
return makeInlineCalculation('VALUE >= 0 ? Math.floor(VALUE) : Math.ceil(VALUE)', value, 'tempBigIntR');
+/* refactored version - needs perf testing TODO
+ if (bits <= 32) {
+ if (signed) {
+ return '((' + value + ')&-1)'; // &-1 (instead of |0) hints to the js optimizer that this is a rounding correction
+ } else {
+ return '((' + value + ')>>>0)';
+ }
+ }
+ // Math.floor is reasonably fast if we don't care about corrections (and even correct if unsigned)
+ if (!correctRoundings() || !signed) return 'Math.floor(' + value + ')';
+ // We are left with >32 bits
+ return makeInlineCalculation('VALUE >= 0 ? Math.floor(VALUE) : Math.ceil(VALUE)', value, 'tempBigIntR');
+*/
}
// fptoui and fptosi are not in these, because we need to be careful about what we do there. We can't