Chromium Code Reviews| Index: runtime/lib/bigint.dart |
| =================================================================== |
| --- runtime/lib/bigint.dart (revision 40444) |
| +++ runtime/lib/bigint.dart (working copy) |
| @@ -70,8 +70,14 @@ |
| int get _used native "Bigint_getUsed"; |
| void set _used(int used) native "Bigint_setUsed"; |
| Uint32List get _digits native "Bigint_getDigits"; |
| - void set _digits(Uint32List digits) native "Bigint_setDigits"; |
| + void set _digits(Uint32List digits) { |
| + // The VM expects digits_ to be a Uint32List. |
| + assert(digits != null); |
| + _set_digits(digits); |
| + } |
|
regis
2014/09/18 20:18:22
If I understand correctly, this indirection only v
srdjan
2014/09/18 20:59:18
Inliner eliminates the indirection; I will add thi
|
| + void _set_digits(Uint32List digits) native "Bigint_setDigits"; |
| + |
| // Factory returning an instance initialized to value 0. |
| factory _Bigint() native "Bigint_allocate"; |
| @@ -203,10 +209,8 @@ |
| var digits = _digits; |
| if (length > 0 && (digits == null || length > digits.length)) { |
|
regis
2014/09/18 20:18:22
You should remove the term digits == null.
srdjan
2014/09/18 20:59:18
Done.
|
| var new_digits = new Uint32List(length + EXTRA_DIGITS); |
| - if (digits != null) { |
| - for (var i = _used; --i >= 0; ) { |
| - new_digits[i] = digits[i]; |
| - } |
| + for (var i = _used; --i >= 0; ) { |
| + new_digits[i] = digits[i]; |
| } |
| _digits = new_digits; |
| } |
| @@ -987,7 +991,7 @@ |
| if (_neg) throw "negative shift amount"; // TODO(regis): What exception? |
| assert(DIGIT_BITS == 32); // Otherwise this code needs to be revised. |
| var shift; |
| - if (_used > 2 || (_used == 2 && _digits[1] > 0x10000000)) { |
| + if ((_used > 2) || ((_used == 2) && (_digits[1] > 0x10000000))) { |
|
regis
2014/09/18 20:18:22
My understanding is that we only use extra parenth
srdjan
2014/09/18 20:59:18
I think we should use it in all VM related code (i
|
| if (other < 0) { |
| return -1; |
| } else { |