Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: runtime/lib/bigint.dart

Issue 2980243002: Add comments for constants which replaced large integer literals (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | runtime/lib/typed_data_patch.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'dart:typed_data' show Uint32List; 5 import 'dart:typed_data' show Uint32List;
6 6
7 // Copyright 2009 The Go Authors. All rights reserved. 7 // Copyright 2009 The Go Authors. All rights reserved.
8 // Use of this source code is governed by a BSD-style 8 // Use of this source code is governed by a BSD-style
9 // license that can be found in the LICENSE file. 9 // license that can be found in the LICENSE file.
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 // Bits per digit. 50 // Bits per digit.
51 static const int _DIGIT_BITS = 32; 51 static const int _DIGIT_BITS = 32;
52 static const int _LOG2_DIGIT_BITS = 5; 52 static const int _LOG2_DIGIT_BITS = 5;
53 static const int _DIGIT_BASE = 1 << _DIGIT_BITS; 53 static const int _DIGIT_BASE = 1 << _DIGIT_BITS;
54 static const int _DIGIT_MASK = (1 << _DIGIT_BITS) - 1; 54 static const int _DIGIT_MASK = (1 << _DIGIT_BITS) - 1;
55 55
56 // Bits per half digit. 56 // Bits per half digit.
57 static const int _DIGIT2_BITS = _DIGIT_BITS >> 1; 57 static const int _DIGIT2_BITS = _DIGIT_BITS >> 1;
58 static const int _DIGIT2_MASK = (1 << _DIGIT2_BITS) - 1; 58 static const int _DIGIT2_MASK = (1 << _DIGIT2_BITS) - 1;
59 59
60 // Bits per 2 digits 60 // Bits per 2 digits. Used to perform modulo 2^64 arithmetic.
61 // Note: in --limit-ints-to-64-bits mode most arithmetic operations are
62 // already modulo 2^64. Still, it is harmless to apply _TWO_DIGITS_MASK:
63 // (1 << _TWO_DIGITS_BITS) is 0 (all bits are shifted out), so
64 // _TWO_DIGITS_MASK is -1 (its bit pattern is 0xffffffffffffffff).
61 static const int _TWO_DIGITS_BITS = _DIGIT_BITS << 1; 65 static const int _TWO_DIGITS_BITS = _DIGIT_BITS << 1;
62 static const int _TWO_DIGITS_MASK = (1 << _TWO_DIGITS_BITS) - 1; 66 static const int _TWO_DIGITS_MASK = (1 << _TWO_DIGITS_BITS) - 1;
63 67
64 // Min and max of non bigint values. 68 // Min and max of non bigint values.
65 static const int _MIN_INT64 = (-1) << 63; 69 static const int _MIN_INT64 = (-1) << 63;
66 static const int _MAX_INT64 = 0x7fffffffffffffff; 70 static const int _MAX_INT64 = 0x7fffffffffffffff;
67 71
68 // Bigint constant values. 72 // Bigint constant values.
69 // Note: Not declared as final in order to satisfy optimizer, which expects 73 // Note: Not declared as final in order to satisfy optimizer, which expects
70 // constants to be in canonical form (Smi). 74 // constants to be in canonical form (Smi).
(...skipping 2048 matching lines...) Expand 10 before | Expand all | Expand 10 after
2119 return _reduce(r_digits, r_used); 2123 return _reduce(r_digits, r_used);
2120 } 2124 }
2121 2125
2122 int _mul(Uint32List x_digits, int x_used, Uint32List y_digits, int y_used, 2126 int _mul(Uint32List x_digits, int x_used, Uint32List y_digits, int y_used,
2123 Uint32List r_digits) { 2127 Uint32List r_digits) {
2124 var r_used = 2128 var r_used =
2125 _Bigint._mulDigits(x_digits, x_used, y_digits, y_used, r_digits); 2129 _Bigint._mulDigits(x_digits, x_used, y_digits, y_used, r_digits);
2126 return _reduce(r_digits, r_used); 2130 return _reduce(r_digits, r_used);
2127 } 2131 }
2128 } 2132 }
OLDNEW
« no previous file with comments | « no previous file | runtime/lib/typed_data_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698