diff options
| author | Alon Zakai <alonzakai@gmail.com> | 2011-11-26 16:57:21 -0800 | 
|---|---|---|
| committer | Alon Zakai <alonzakai@gmail.com> | 2011-11-26 16:57:21 -0800 | 
| commit | 8c9b89833a09980f64bba918d68288f4e51db596 (patch) | |
| tree | 8d50c9928a0834a94bc4a23c03e9a6c81a4c590f /src/parseTools.js | |
| parent | 0d18a1646a7932058b5f6127cda706970e9d2ce5 (diff) | |
clean up signing code
Diffstat (limited to 'src/parseTools.js')
| -rw-r--r-- | src/parseTools.js | 9 | 
1 files changed, 6 insertions, 3 deletions
diff --git a/src/parseTools.js b/src/parseTools.js index acb5c9cd..abc59a5a 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -1487,12 +1487,15 @@ function makeSignOp(value, type, op, force) {            return '((' + value + ')|0)';          } else {            return '((' + value + ')>>>0)'; +          // Alternatively, we can consider the lengthier +          //    return makeInlineCalculation('VALUE >= 0 ? VALUE : ' + Math.pow(2, bits) + ' + VALUE', value, 'tempBigInt'); +          // which does not always turn us into a 32-bit *un*signed value          }        } else if (bits < 32) { -        if (op === 'un') { -          return '((' + value + ')&' + (Math.pow(2, bits)-1) + ')'; -        } else { +        if (op === 're') {            return makeInlineCalculation('VALUE >= ' + Math.pow(2, bits-1) + ' ? VALUE-' + Math.pow(2, bits) + ' : VALUE', value, 'tempInt'); +        } else { +          return '((' + value + ')&' + (Math.pow(2, bits)-1) + ')';          }        }      }  | 
