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

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

Issue 2571563005: Turn the VM's dart:typed_data into a patch (Closed)
Patch Set: Fix interface/implementation type mismatch Created 3 years, 12 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 | « runtime/lib/typed_data.dart ('k') | runtime/lib/typed_data_sources.gypi » ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 // Unlike the other SDK libraries, this file is not a patch that is applied to
6 // dart:typed_data. Instead, it completely replaces the implementation from the
7 // SDK.
8 library dart.typed_data;
9
10 import "dart:_internal"; 5 import "dart:_internal";
11 import "dart:collection" show ListBase; 6 import "dart:collection" show ListBase;
12 import 'dart:math' show Random; 7 import 'dart:math' show Random;
13 8
14 /** 9 @patch
15 * A typed view of a sequence of bytes.
16 */
17 abstract class TypedData {
18 /**
19 * Returns the number of bytes in the representation of each element in this
20 * list.
21 */
22 int get elementSizeInBytes;
23
24 /**
25 * Returns the offset in bytes into the underlying byte buffer of this view.
26 */
27 int get offsetInBytes;
28
29 /**
30 * Returns the length of this view, in bytes.
31 */
32 int get lengthInBytes;
33
34 /**
35 * Returns the byte buffer associated with this object.
36 */
37 ByteBuffer get buffer;
38 }
39
40
41 /**
42 * Describes endianness to be used when accessing or updating a
43 * sequence of bytes.
44 */
45 class Endianness {
46 const Endianness._(this._littleEndian);
47
48 static const Endianness BIG_ENDIAN = const Endianness._(false);
49 static const Endianness LITTLE_ENDIAN = const Endianness._(true);
50 static final Endianness HOST_ENDIAN =
51 (new ByteData.view(new Uint16List.fromList([1]).buffer)).getInt8(0) == 1 ?
52 LITTLE_ENDIAN : BIG_ENDIAN;
53
54 final bool _littleEndian;
55 }
56
57
58 /**
59 * A fixed-length, random-access sequence of bytes that also provides random
60 * and unaligned access to the fixed-width integers and floating point
61 * numbers represented by those bytes.
62 *
63 * `ByteData` may be used to pack and unpack data from external sources
64 * (such as networks or files systems), and to process large quantities
65 * of numerical data more efficiently than would be possible
66 * with ordinary [List] implementations.
67 * `ByteData` can save space, by eliminating the need for object headers,
68 * and time, by eliminating the need for data copies.
69 * Finally, `ByteData` may be used to intentionally reinterpret the bytes
70 * representing one arithmetic type as another.
71 * For example this code fragment determine what 32-bit signed integer
72 * is represented by the bytes of a 32-bit floating point number:
73 *
74 * var buffer = new Uint8List(8).buffer;
75 * var bdata = new ByteData.view(buffer);
76 * bdata.setFloat32(0, 3.04);
77 * int huh = bdata.getInt32(0);
78 */
79 class ByteData implements TypedData { 10 class ByteData implements TypedData {
80 /** 11 @patch
81 * Creates a [ByteData] of the specified length (in elements), all of
82 * whose bytes are initially zero.
83 */
84 factory ByteData(int length) { 12 factory ByteData(int length) {
85 var list = new Uint8List(length); 13 var list = new Uint8List(length);
86 return new _ByteDataView(list, 0, length); 14 return new _ByteDataView(list, 0, length);
87 } 15 }
88 16
89 // Called directly from C code. 17 // Called directly from C code.
90 factory ByteData._view(TypedData typedData, int offsetInBytes, int length) { 18 factory ByteData._view(TypedData typedData, int offsetInBytes, int length) {
91 return new _ByteDataView(typedData, offsetInBytes, length); 19 return new _ByteDataView(typedData, offsetInBytes, length);
92 } 20 }
93
94 /**
95 * Creates an [ByteData] _view_ of the specified region in [buffer].
96 *
97 * Changes in the [ByteData] will be visible in the byte
98 * buffer and vice versa.
99 * If the [offsetInBytes] index of the region is not specified,
100 * it defaults to zero (the first byte in the byte buffer).
101 * If the length is not specified, it defaults to `null`,
102 * which indicates that the view extends to the end of the byte buffer.
103 *
104 * Throws [RangeError] if [offsetInBytes] or [length] are negative, or
105 * if [offsetInBytes] + ([length] * elementSizeInBytes) is greater than
106 * the length of [buffer].
107 */
108 factory ByteData.view(ByteBuffer buffer,
109 [int offsetInBytes = 0, int length]) {
110 return buffer.asByteData(offsetInBytes, length);
111 }
112
113 /**
114 * Returns the (possibly negative) integer represented by the byte at the
115 * specified [byteOffset] in this object, in two's complement binary
116 * representation.
117 *
118 * The return value will be between -128 and 127, inclusive.
119 *
120 * Throws [RangeError] if [byteOffset] is negative, or
121 * greater than or equal to the length of this object.
122 */
123 int getInt8(int byteOffset);
124
125 /**
126 * Sets the byte at the specified [byteOffset] in this object to the
127 * two's complement binary representation of the specified [value], which
128 * must fit in a single byte.
129 *
130 * In other words, [value] must be between -128 and 127, inclusive.
131 *
132 * Throws [RangeError] if [byteOffset] is negative, or
133 * greater than or equal to the length of this object.
134 */
135 void setInt8(int byteOffset, int value);
136
137 /**
138 * Returns the positive integer represented by the byte at the specified
139 * [byteOffset] in this object, in unsigned binary form.
140 *
141 * The return value will be between 0 and 255, inclusive.
142 *
143 * Throws [RangeError] if [byteOffset] is negative, or
144 * greater than or equal to the length of this object.
145 */
146 int getUint8(int byteOffset);
147
148 /**
149 * Sets the byte at the specified [byteOffset] in this object to the
150 * unsigned binary representation of the specified [value], which must fit
151 * in a single byte.
152 *
153 * In other words, [value] must be between 0 and 255, inclusive.
154 *
155 * Throws [RangeError] if [byteOffset] is negative,
156 * or greater than or equal to the length of this object.
157 */
158 void setUint8(int byteOffset, int value);
159
160 /**
161 * Returns the (possibly negative) integer represented by the two bytes at
162 * the specified [byteOffset] in this object, in two's complement binary
163 * form.
164 *
165 * The return value will be between 2<sup>15</sup> and 2<sup>15</sup> - 1,
166 * inclusive.
167 *
168 * Throws [RangeError] if [byteOffset] is negative, or
169 * `byteOffset + 2` is greater than the length of this object.
170 */
171 int getInt16(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]);
172
173 /**
174 * Sets the two bytes starting at the specified [byteOffset] in this
175 * object to the two's complement binary representation of the specified
176 * [value], which must fit in two bytes.
177 *
178 * In other words, [value] must lie
179 * between 2<sup>15</sup> and 2<sup>15</sup> - 1, inclusive.
180 *
181 * Throws [RangeError] if [byteOffset] is negative, or
182 * `byteOffset + 2` is greater than the length of this object.
183 */
184 void setInt16(int byteOffset,
185 int value,
186 [Endianness endian = Endianness.BIG_ENDIAN]);
187
188 /**
189 * Returns the positive integer represented by the two bytes starting
190 * at the specified [byteOffset] in this object, in unsigned binary
191 * form.
192 *
193 * The return value will be between 0 and 2<sup>16</sup> - 1, inclusive.
194 *
195 * Throws [RangeError] if [byteOffset] is negative, or
196 * `byteOffset + 2` is greater than the length of this object.
197 */
198 int getUint16(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]);
199
200 /**
201 * Sets the two bytes starting at the specified [byteOffset] in this object
202 * to the unsigned binary representation of the specified [value],
203 * which must fit in two bytes.
204 *
205 * In other words, [value] must be between
206 * 0 and 2<sup>16</sup> - 1, inclusive.
207 *
208 * Throws [RangeError] if [byteOffset] is negative, or
209 * `byteOffset + 2` is greater than the length of this object.
210 */
211 void setUint16(int byteOffset,
212 int value,
213 [Endianness endian = Endianness.BIG_ENDIAN]);
214
215 /**
216 * Returns the (possibly negative) integer represented by the four bytes at
217 * the specified [byteOffset] in this object, in two's complement binary
218 * form.
219 *
220 * The return value will be between 2<sup>31</sup> and 2<sup>31</sup> - 1,
221 * inclusive.
222 *
223 * Throws [RangeError] if [byteOffset] is negative, or
224 * `byteOffset + 4` is greater than the length of this object.
225 */
226 int getInt32(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]);
227
228 /**
229 * Sets the four bytes starting at the specified [byteOffset] in this
230 * object to the two's complement binary representation of the specified
231 * [value], which must fit in four bytes.
232 *
233 * In other words, [value] must lie
234 * between 2<sup>31</sup> and 2<sup>31</sup> - 1, inclusive.
235 *
236 * Throws [RangeError] if [byteOffset] is negative, or
237 * `byteOffset + 4` is greater than the length of this object.
238 */
239 void setInt32(int byteOffset,
240 int value,
241 [Endianness endian = Endianness.BIG_ENDIAN]);
242
243 /**
244 * Returns the positive integer represented by the four bytes starting
245 * at the specified [byteOffset] in this object, in unsigned binary
246 * form.
247 *
248 * The return value will be between 0 and 2<sup>32</sup> - 1, inclusive.
249 *
250 * Throws [RangeError] if [byteOffset] is negative, or
251 * `byteOffset + 4` is greater than the length of this object.
252 */
253 int getUint32(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]);
254
255 /**
256 * Sets the four bytes starting at the specified [byteOffset] in this object
257 * to the unsigned binary representation of the specified [value],
258 * which must fit in four bytes.
259 *
260 * In other words, [value] must be between
261 * 0 and 2<sup>32</sup> - 1, inclusive.
262 *
263 * Throws [RangeError] if [byteOffset] is negative, or
264 * `byteOffset + 4` is greater than the length of this object.
265 */
266 void setUint32(int byteOffset,
267 int value,
268 [Endianness endian = Endianness.BIG_ENDIAN]);
269
270 /**
271 * Returns the (possibly negative) integer represented by the eight bytes at
272 * the specified [byteOffset] in this object, in two's complement binary
273 * form.
274 *
275 * The return value will be between 2<sup>63</sup> and 2<sup>63</sup> - 1,
276 * inclusive.
277 *
278 * Throws [RangeError] if [byteOffset] is negative, or
279 * `byteOffset + 8` is greater than the length of this object.
280 */
281 int getInt64(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]);
282
283 /**
284 * Sets the eight bytes starting at the specified [byteOffset] in this
285 * object to the two's complement binary representation of the specified
286 * [value], which must fit in eight bytes.
287 *
288 * In other words, [value] must lie
289 * between 2<sup>63</sup> and 2<sup>63</sup> - 1, inclusive.
290 *
291 * Throws [RangeError] if [byteOffset] is negative, or
292 * `byteOffset + 8` is greater than the length of this object.
293 */
294 void setInt64(int byteOffset,
295 int value,
296 [Endianness endian = Endianness.BIG_ENDIAN]);
297
298 /**
299 * Returns the positive integer represented by the eight bytes starting
300 * at the specified [byteOffset] in this object, in unsigned binary
301 * form.
302 *
303 * The return value will be between 0 and 2<sup>64</sup> - 1, inclusive.
304 *
305 * Throws [RangeError] if [byteOffset] is negative, or
306 * `byteOffset + 8` is greater than the length of this object.
307 */
308 int getUint64(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]);
309
310 /**
311 * Sets the eight bytes starting at the specified [byteOffset] in this object
312 * to the unsigned binary representation of the specified [value],
313 * which must fit in eight bytes.
314 *
315 * In other words, [value] must be between
316 * 0 and 2<sup>64</sup> - 1, inclusive.
317 *
318 * Throws [RangeError] if [byteOffset] is negative, or
319 * `byteOffset + 8` is greater than the length of this object.
320 */
321 void setUint64(int byteOffset,
322 int value,
323 [Endianness endian = Endianness.BIG_ENDIAN]);
324
325 /**
326 * Returns the floating point number represented by the four bytes at
327 * the specified [byteOffset] in this object, in IEEE 754
328 * single-precision binary floating-point format (binary32).
329 *
330 * Throws [RangeError] if [byteOffset] is negative, or
331 * `byteOffset + 4` is greater than the length of this object.
332 */
333 double getFloat32(int byteOffset,
334 [Endianness endian = Endianness.BIG_ENDIAN]);
335
336 /**
337 * Sets the four bytes starting at the specified [byteOffset] in this
338 * object to the IEEE 754 single-precision binary floating-point
339 * (binary32) representation of the specified [value].
340 *
341 * **Note that this method can lose precision.** The input [value] is
342 * a 64-bit floating point value, which will be converted to 32-bit
343 * floating point value by IEEE 754 rounding rules before it is stored.
344 * If [value] cannot be represented exactly as a binary32, it will be
345 * converted to the nearest binary32 value. If two binary32 values are
346 * equally close, the one whose least significant bit is zero will be used.
347 * Note that finite (but large) values can be converted to infinity, and
348 * small non-zero values can be converted to zero.
349 *
350 * Throws [RangeError] if [byteOffset] is negative, or
351 * `byteOffset + 4` is greater than the length of this object.
352 */
353 void setFloat32(int byteOffset,
354 double value,
355 [Endianness endian = Endianness.BIG_ENDIAN]);
356
357 /**
358 * Returns the floating point number represented by the eight bytes at
359 * the specified [byteOffset] in this object, in IEEE 754
360 * double-precision binary floating-point format (binary64).
361 *
362 * Throws [RangeError] if [byteOffset] is negative, or
363 * `byteOffset + 8` is greater than the length of this object.
364 */
365 double getFloat64(int byteOffset,
366 [Endianness endian = Endianness.BIG_ENDIAN]);
367
368 /**
369 * Sets the eight bytes starting at the specified [byteOffset] in this
370 * object to the IEEE 754 double-precision binary floating-point
371 * (binary64) representation of the specified [value].
372 *
373 * Throws [RangeError] if [byteOffset] is negative, or
374 * `byteOffset + 8` is greater than the length of this object.
375 */
376 void setFloat64(int byteOffset,
377 double value,
378 [Endianness endian = Endianness.BIG_ENDIAN]);
379 } 21 }
380 22
381
382 // Based class for _TypedList that provides common methods for implementing 23 // Based class for _TypedList that provides common methods for implementing
383 // the collection and list interfaces. 24 // the collection and list interfaces.
384 // This class does not extend ListBase<T> since that would add type arguments 25 // This class does not extend ListBase<T> since that would add type arguments
385 // to instances of _TypeListBase. Instead the subclasses use type specific 26 // to instances of _TypeListBase. Instead the subclasses use type specific
386 // mixins (like _IntListMixin, _DoubleListMixin) to implement ListBase<T>. 27 // mixins (like _IntListMixin, _DoubleListMixin) to implement ListBase<T>.
387 abstract class _TypedListBase { 28 abstract class _TypedListBase {
388
389 // Method(s) implementing the Collection interface. 29 // Method(s) implementing the Collection interface.
390 bool contains(element) { 30 bool contains(element) {
391 var len = this.length; 31 var len = this.length;
392 for (var i = 0; i < len; ++i) { 32 for (var i = 0; i < len; ++i) {
393 if (this[i] == element) return true; 33 if (this[i] == element) return true;
394 } 34 }
395 return false; 35 return false;
396 } 36 }
397 37
398 void forEach(void f(element)) { 38 void forEach(void f(element)) {
(...skipping 13 matching lines...) Expand all
412 var len = this.length; 52 var len = this.length;
413 if (len == 0) throw IterableElementError.noElement(); 53 if (len == 0) throw IterableElementError.noElement();
414 var i = 0; 54 var i = 0;
415 var value = this[0]; 55 var value = this[0];
416 for (var i = 1; i < len; ++i) { 56 for (var i = 1; i < len; ++i) {
417 value = combine(value, this[i]); 57 value = combine(value, this[i]);
418 } 58 }
419 return value; 59 return value;
420 } 60 }
421 61
422 dynamic fold(dynamic initialValue, 62 dynamic fold(
423 dynamic combine(dynamic initialValue, element)) { 63 dynamic initialValue, dynamic combine(dynamic initialValue, element)) {
424 var len = this.length; 64 var len = this.length;
425 for (var i = 0; i < len; ++i) { 65 for (var i = 0; i < len; ++i) {
426 initialValue = combine(initialValue, this[i]); 66 initialValue = combine(initialValue, this[i]);
427 } 67 }
428 return initialValue; 68 return initialValue;
429 } 69 }
430 70
431 Iterable map(f(element)) => new MappedIterable(this, f); 71 Iterable map(f(element)) => new MappedIterable(this, f);
432 72
433 Iterable expand(Iterable f(element)) => new ExpandIterable(this, f); 73 Iterable expand(Iterable f(element)) => new ExpandIterable(this, f);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 135
496 bool get isEmpty { 136 bool get isEmpty {
497 return this.length == 0; 137 return this.length == 0;
498 } 138 }
499 139
500 bool get isNotEmpty => !isEmpty; 140 bool get isNotEmpty => !isEmpty;
501 141
502 // Method(s) implementing the List interface. 142 // Method(s) implementing the List interface.
503 143
504 set length(newLength) { 144 set length(newLength) {
505 throw new UnsupportedError( 145 throw new UnsupportedError("Cannot resize a fixed-length list");
506 "Cannot resize a fixed-length list");
507 } 146 }
508 147
509 void add(value) { 148 void add(value) {
510 throw new UnsupportedError( 149 throw new UnsupportedError("Cannot add to a fixed-length list");
511 "Cannot add to a fixed-length list");
512 } 150 }
513 151
514 void addAll(Iterable value) { 152 void addAll(Iterable value) {
515 throw new UnsupportedError( 153 throw new UnsupportedError("Cannot add to a fixed-length list");
516 "Cannot add to a fixed-length list");
517 } 154 }
518 155
519 void insert(int index, value) { 156 void insert(int index, value) {
520 throw new UnsupportedError( 157 throw new UnsupportedError("Cannot insert into a fixed-length list");
521 "Cannot insert into a fixed-length list");
522 } 158 }
523 159
524 void insertAll(int index, Iterable values) { 160 void insertAll(int index, Iterable values) {
525 throw new UnsupportedError( 161 throw new UnsupportedError("Cannot insert into a fixed-length list");
526 "Cannot insert into a fixed-length list");
527 } 162 }
528 163
529 void sort([int compare(a, b)]) { 164 void sort([int compare(a, b)]) {
530 if (compare == null) compare = Comparable.compare; 165 if (compare == null) compare = Comparable.compare;
531 Sort.sort(this, compare); 166 Sort.sort(this, compare);
532 } 167 }
533 168
534 void shuffle([Random random]) { 169 void shuffle([Random random]) {
535 if (random == null) random = new Random(); 170 if (random == null) random = new Random();
536 var i = this.length; 171 var i = this.length;
537 while (i > 1) { 172 while (i > 1) {
538 int pos = random.nextInt(i); 173 int pos = random.nextInt(i);
539 i -= 1; 174 i -= 1;
540 var tmp = this[i]; 175 var tmp = this[i];
541 this[i] = this[pos]; 176 this[i] = this[pos];
542 this[pos] = tmp; 177 this[pos] = tmp;
543 } 178 }
544 } 179 }
545 180
546 int indexOf(element, [int start = 0]) { 181 int indexOf(element, [int start = 0]) {
547 return Lists.indexOf(this, element, start, this.length); 182 return Lists.indexOf(this, element, start, this.length);
548 } 183 }
549 184
550 int lastIndexOf(element, [int start = null]) { 185 int lastIndexOf(element, [int start = null]) {
551 if (start == null) start = this.length - 1; 186 if (start == null) start = this.length - 1;
552 return Lists.lastIndexOf(this, element, start); 187 return Lists.lastIndexOf(this, element, start);
553 } 188 }
554 189
555 void clear() { 190 void clear() {
556 throw new UnsupportedError( 191 throw new UnsupportedError("Cannot remove from a fixed-length list");
557 "Cannot remove from a fixed-length list");
558 } 192 }
559 193
560 int removeLast() { 194 int removeLast() {
561 throw new UnsupportedError( 195 throw new UnsupportedError("Cannot remove from a fixed-length list");
562 "Cannot remove from a fixed-length list");
563 } 196 }
564 197
565 bool remove(Object element) { 198 bool remove(Object element) {
566 throw new UnsupportedError( 199 throw new UnsupportedError("Cannot remove from a fixed-length list");
567 "Cannot remove from a fixed-length list");
568 } 200 }
569 201
570 bool removeAt(int index) { 202 bool removeAt(int index) {
571 throw new UnsupportedError( 203 throw new UnsupportedError("Cannot remove from a fixed-length list");
572 "Cannot remove from a fixed-length list");
573 } 204 }
574 205
575 void removeWhere(bool test(element)) { 206 void removeWhere(bool test(element)) {
576 throw new UnsupportedError( 207 throw new UnsupportedError("Cannot remove from a fixed-length list");
577 "Cannot remove from a fixed-length list");
578 } 208 }
579 209
580 void retainWhere(bool test(element)) { 210 void retainWhere(bool test(element)) {
581 throw new UnsupportedError( 211 throw new UnsupportedError("Cannot remove from a fixed-length list");
582 "Cannot remove from a fixed-length list");
583 } 212 }
584 213
585 dynamic get first { 214 dynamic get first {
586 if (length > 0) return this[0]; 215 if (length > 0) return this[0];
587 throw IterableElementError.noElement(); 216 throw IterableElementError.noElement();
588 } 217 }
589 218
590 dynamic get last { 219 dynamic get last {
591 if (length > 0) return this[length - 1]; 220 if (length > 0) return this[length - 1];
592 throw IterableElementError.noElement(); 221 throw IterableElementError.noElement();
593 } 222 }
594 223
595 dynamic get single { 224 dynamic get single {
596 if (length == 1) return this[0]; 225 if (length == 1) return this[0];
597 if (length == 0) throw IterableElementError.noElement(); 226 if (length == 0) throw IterableElementError.noElement();
598 throw IterableElementError.tooMany(); 227 throw IterableElementError.tooMany();
599 } 228 }
600 229
601 void removeRange(int start, int end) { 230 void removeRange(int start, int end) {
602 throw new UnsupportedError( 231 throw new UnsupportedError("Cannot remove from a fixed-length list");
603 "Cannot remove from a fixed-length list");
604 } 232 }
605 233
606 void replaceRange(int start, int end, Iterable iterable) { 234 void replaceRange(int start, int end, Iterable iterable) {
607 throw new UnsupportedError( 235 throw new UnsupportedError("Cannot remove from a fixed-length list");
608 "Cannot remove from a fixed-length list");
609 } 236 }
610 237
611 List toList({bool growable: true}) { 238 List toList({bool growable: true}) {
612 return new List.from(this, growable: growable); 239 return new List.from(this, growable: growable);
613 } 240 }
614 241
615 Set toSet() { 242 Set toSet() {
616 return new Set.from(this); 243 return new Set.from(this);
617 } 244 }
618 245
619 List sublist(int start, [int end]) { 246 List sublist(int start, [int end]) {
620 end = RangeError.checkValidRange(start, end, this.length); 247 end = RangeError.checkValidRange(start, end, this.length);
621 var length = end - start; 248 var length = end - start;
622 List result = _createList(length); 249 List result = _createList(length);
623 result.setRange(0, length, this, start); 250 result.setRange(0, length, this, start);
624 return result; 251 return result;
625 } 252 }
626 253
627 void setRange(int start, int end, Iterable from, [int skipCount = 0]) { 254 void setRange(int start, int end, Iterable from, [int skipCount = 0]) {
628 // Check ranges. 255 // Check ranges.
629 if (0 > start || start > end || end > length) { 256 if (0 > start || start > end || end > length) {
630 RangeError.checkValidRange(start, end, length); // Always throws. 257 RangeError.checkValidRange(start, end, length); // Always throws.
631 assert(false); 258 assert(false);
632 } 259 }
633 if (skipCount < 0) { 260 if (skipCount < 0) {
634 throw new ArgumentError(skipCount); 261 throw new ArgumentError(skipCount);
635 } 262 }
636 263
637 final count = end - start; 264 final count = end - start;
638 if ((from.length - skipCount) < count) { 265 if ((from.length - skipCount) < count) {
639 throw IterableElementError.tooFew(); 266 throw IterableElementError.tooFew();
640 } 267 }
641 268
642 if (from is _TypedListBase) { 269 if (from is _TypedListBase) {
643 if (this.elementSizeInBytes == from.elementSizeInBytes) { 270 if (this.elementSizeInBytes == from.elementSizeInBytes) {
644 if ((count < 10) && (from.buffer != this.buffer)) { 271 if ((count < 10) && (from.buffer != this.buffer)) {
645 Lists.copy(from, skipCount, this, start, count); 272 Lists.copy(from, skipCount, this, start, count);
646 return; 273 return;
647 } else if (this.buffer._data._setRange( 274 } else if (this.buffer._data._setRange(
648 start * elementSizeInBytes + this.offsetInBytes, 275 start * elementSizeInBytes + this.offsetInBytes,
649 count * elementSizeInBytes, 276 count * elementSizeInBytes,
650 from.buffer._data, 277 from.buffer._data,
651 skipCount * elementSizeInBytes + from.offsetInBytes, 278 skipCount * elementSizeInBytes + from.offsetInBytes,
652 ClassID.getID(this), ClassID.getID(from))) { 279 ClassID.getID(this),
280 ClassID.getID(from))) {
653 return; 281 return;
654 } 282 }
655 } else if (from.buffer == this.buffer) { 283 } else if (from.buffer == this.buffer) {
656 // Different element sizes, but same buffer means that we need 284 // Different element sizes, but same buffer means that we need
657 // an intermediate structure. 285 // an intermediate structure.
658 // TODO(srdjan): Optimize to skip copying if the range does not overlap. 286 // TODO(srdjan): Optimize to skip copying if the range does not overlap.
659 final temp_buffer = new List(count); 287 final temp_buffer = new List(count);
660 for (var i = 0; i < count; i++) { 288 for (var i = 0; i < count; i++) {
661 temp_buffer[i] = from[skipCount + i]; 289 temp_buffer[i] = from[skipCount + i];
662 } 290 }
(...skipping 25 matching lines...) Expand all
688 setRange(index, end, iterable); 316 setRange(index, end, iterable);
689 } 317 }
690 318
691 void fillRange(int start, int end, [fillValue]) { 319 void fillRange(int start, int end, [fillValue]) {
692 RangeError.checkValidRange(start, end, this.length); 320 RangeError.checkValidRange(start, end, this.length);
693 for (var i = start; i < end; ++i) { 321 for (var i = start; i < end; ++i) {
694 this[i] = fillValue; 322 this[i] = fillValue;
695 } 323 }
696 } 324 }
697 325
698
699 // Method(s) implementing Object interface. 326 // Method(s) implementing Object interface.
700
701 String toString() => ListBase.listToString(this); 327 String toString() => ListBase.listToString(this);
702 328
703
704 // Internal utility methods. 329 // Internal utility methods.
705 330
706 // Returns true if operation succeeds. 331 // Returns true if operation succeeds.
707 // 'fromCid' and 'toCid' may be cid-s of the views and therefore may not 332 // 'fromCid' and 'toCid' may be cid-s of the views and therefore may not
708 // match the cids of 'this' and 'from'. 333 // match the cids of 'this' and 'from'.
709 // Uses toCid and fromCid to decide if clamping is necessary. 334 // Uses toCid and fromCid to decide if clamping is necessary.
710 // Element size of toCid and fromCid must match (test at caller). 335 // Element size of toCid and fromCid must match (test at caller).
711 bool _setRange(int startInBytes, int lengthInBytes, 336 bool _setRange(int startInBytes, int lengthInBytes, _TypedListBase from,
712 _TypedListBase from, int startFromInBytes, 337 int startFromInBytes, int toCid, int fromCid) native "TypedData_setRange";
713 int toCid, int fromCid)
714 native "TypedData_setRange";
715 } 338 }
716 339
717
718 class _IntListMixin { 340 class _IntListMixin {
719 Iterable<int> where(bool f(int element)) => new WhereIterable<int>(this, f); 341 Iterable<int> where(bool f(int element)) => new WhereIterable<int>(this, f);
720 342
721 Iterable<int> take(int n) => new SubListIterable<int>(this, 0, n); 343 Iterable<int> take(int n) => new SubListIterable<int>(this, 0, n);
722 344
723 Iterable<int> takeWhile(bool test(int element)) => 345 Iterable<int> takeWhile(bool test(int element)) =>
724 new TakeWhileIterable<int>(this, test); 346 new TakeWhileIterable<int>(this, test);
725 347
726 Iterable<int> skip(int n) => new SubListIterable<int>(this, n, null); 348 Iterable<int> skip(int n) => new SubListIterable<int>(this, n, null);
727 349
728 Iterable<int> skipWhile(bool test(element)) => 350 Iterable<int> skipWhile(bool test(element)) =>
729 new SkipWhileIterable<int>(this, test); 351 new SkipWhileIterable<int>(this, test);
730 352
731 Iterable<int> get reversed => new ReversedListIterable<int>(this); 353 Iterable<int> get reversed => new ReversedListIterable<int>(this);
732 354
733 Map<int, int> asMap() => new ListMapView<int>(this); 355 Map<int, int> asMap() => new ListMapView<int>(this);
734 356
735 Iterable<int> getRange(int start, [int end]) { 357 Iterable<int> getRange(int start, [int end]) {
736 RangeError.checkValidRange(start, end, this.length); 358 RangeError.checkValidRange(start, end, this.length);
737 return new SubListIterable<int>(this, start, end); 359 return new SubListIterable<int>(this, start, end);
738 } 360 }
739 361
740 Iterator<int> get iterator => new _TypedListIterator<int>(this); 362 Iterator<int> get iterator => new _TypedListIterator<int>(this);
741 363
742 List<int> toList({bool growable: true}) { 364 List<int> toList({bool growable: true}) {
743 return new List<int>.from(this, growable: growable); 365 return new List<int>.from(this, growable: growable);
744 } 366 }
745 367
746 Set<int> toSet() { 368 Set<int> toSet() {
747 return new Set<int>.from(this); 369 return new Set<int>.from(this);
748 } 370 }
749 } 371 }
750 372
751
752 class _DoubleListMixin { 373 class _DoubleListMixin {
753 Iterable<double> where(bool f(int element)) => 374 Iterable<double> where(bool f(int element)) =>
754 new WhereIterable<double>(this, f); 375 new WhereIterable<double>(this, f);
755 376
756 Iterable<double> take(int n) => new SubListIterable<double>(this, 0, n); 377 Iterable<double> take(int n) => new SubListIterable<double>(this, 0, n);
757 378
758 Iterable<double> takeWhile(bool test(int element)) => 379 Iterable<double> takeWhile(bool test(int element)) =>
759 new TakeWhileIterable<double>(this, test); 380 new TakeWhileIterable<double>(this, test);
760 381
761 Iterable<double> skip(int n) => new SubListIterable<double>(this, n, null); 382 Iterable<double> skip(int n) => new SubListIterable<double>(this, n, null);
762 383
763 Iterable<double> skipWhile(bool test(element)) => 384 Iterable<double> skipWhile(bool test(element)) =>
764 new SkipWhileIterable<double>(this, test); 385 new SkipWhileIterable<double>(this, test);
765 386
766 Iterable<double> get reversed => new ReversedListIterable<double>(this); 387 Iterable<double> get reversed => new ReversedListIterable<double>(this);
767 388
768 Map<int, double> asMap() => new ListMapView<double>(this); 389 Map<int, double> asMap() => new ListMapView<double>(this);
769 390
770 Iterable<double> getRange(int start, [int end]) { 391 Iterable<double> getRange(int start, [int end]) {
771 RangeError.checkValidRange(start, end, this.length); 392 RangeError.checkValidRange(start, end, this.length);
772 return new SubListIterable<double>(this, start, end); 393 return new SubListIterable<double>(this, start, end);
773 } 394 }
774 395
775 Iterator<double> get iterator => new _TypedListIterator<double>(this); 396 Iterator<double> get iterator => new _TypedListIterator<double>(this);
776 397
777 List<double> toList({bool growable: true}) { 398 List<double> toList({bool growable: true}) {
778 return new List<double>.from(this, growable: growable); 399 return new List<double>.from(this, growable: growable);
779 } 400 }
780 401
781 Set<double> toSet() { 402 Set<double> toSet() {
782 return new Set<double>.from(this); 403 return new Set<double>.from(this);
783 } 404 }
784 } 405 }
785 406
786
787 class _Float32x4ListMixin { 407 class _Float32x4ListMixin {
788 Iterable<Float32x4> where(bool f(int element)) => 408 Iterable<Float32x4> where(bool f(int element)) =>
789 new WhereIterable<Float32x4>(this, f); 409 new WhereIterable<Float32x4>(this, f);
790 410
791 Iterable<Float32x4> take(int n) => new SubListIterable<Float32x4>(this, 0, n); 411 Iterable<Float32x4> take(int n) => new SubListIterable<Float32x4>(this, 0, n);
792 412
793 Iterable<Float32x4> takeWhile(bool test(int element)) => 413 Iterable<Float32x4> takeWhile(bool test(int element)) =>
794 new TakeWhileIterable<Float32x4>(this, test); 414 new TakeWhileIterable<Float32x4>(this, test);
795 415
796 Iterable<Float32x4> skip(int n) => 416 Iterable<Float32x4> skip(int n) =>
797 new SubListIterable<Float32x4>(this, n, null); 417 new SubListIterable<Float32x4>(this, n, null);
798 418
799 Iterable<Float32x4> skipWhile(bool test(element)) => 419 Iterable<Float32x4> skipWhile(bool test(element)) =>
800 new SkipWhileIterable<Float32x4>(this, test); 420 new SkipWhileIterable<Float32x4>(this, test);
801 421
802 Iterable<Float32x4> get reversed => new ReversedListIterable<Float32x4>(this); 422 Iterable<Float32x4> get reversed => new ReversedListIterable<Float32x4>(this);
803 423
804 Map<int, Float32x4> asMap() => new ListMapView<Float32x4>(this); 424 Map<int, Float32x4> asMap() => new ListMapView<Float32x4>(this);
805 425
806 Iterable<Float32x4> getRange(int start, [int end]) { 426 Iterable<Float32x4> getRange(int start, [int end]) {
807 RangeError.checkValidRange(start, end, this.length); 427 RangeError.checkValidRange(start, end, this.length);
808 return new SubListIterable<Float32x4>(this, start, end); 428 return new SubListIterable<Float32x4>(this, start, end);
809 } 429 }
810 430
811 Iterator<Float32x4> get iterator => new _TypedListIterator<Float32x4>(this); 431 Iterator<Float32x4> get iterator => new _TypedListIterator<Float32x4>(this);
812 432
813 List<Float32x4> toList({bool growable: true}) { 433 List<Float32x4> toList({bool growable: true}) {
814 return new List<Float32x4>.from(this, growable: growable); 434 return new List<Float32x4>.from(this, growable: growable);
815 } 435 }
816 436
817 Set<Float32x4> toSet() { 437 Set<Float32x4> toSet() {
818 return new Set<Float32x4>.from(this); 438 return new Set<Float32x4>.from(this);
819 } 439 }
820 } 440 }
821 441
822
823 class _Int32x4ListMixin { 442 class _Int32x4ListMixin {
824 Iterable<Int32x4> where(bool f(int element)) => 443 Iterable<Int32x4> where(bool f(int element)) =>
825 new WhereIterable<Int32x4>(this, f); 444 new WhereIterable<Int32x4>(this, f);
826 445
827 Iterable<Int32x4> take(int n) => new SubListIterable<Int32x4>(this, 0, n); 446 Iterable<Int32x4> take(int n) => new SubListIterable<Int32x4>(this, 0, n);
828 447
829 Iterable<Int32x4> takeWhile(bool test(int element)) => 448 Iterable<Int32x4> takeWhile(bool test(int element)) =>
830 new TakeWhileIterable<Int32x4>(this, test); 449 new TakeWhileIterable<Int32x4>(this, test);
831 450
832 Iterable<Int32x4> skip(int n) => new SubListIterable<Int32x4>(this, n, null); 451 Iterable<Int32x4> skip(int n) => new SubListIterable<Int32x4>(this, n, null);
833 452
834 Iterable<Int32x4> skipWhile(bool test(element)) => 453 Iterable<Int32x4> skipWhile(bool test(element)) =>
835 new SkipWhileIterable<Int32x4>(this, test); 454 new SkipWhileIterable<Int32x4>(this, test);
836 455
837 Iterable<Int32x4> get reversed => new ReversedListIterable<Int32x4>(this); 456 Iterable<Int32x4> get reversed => new ReversedListIterable<Int32x4>(this);
838 457
839 Map<int, Int32x4> asMap() => new ListMapView<Int32x4>(this); 458 Map<int, Int32x4> asMap() => new ListMapView<Int32x4>(this);
840 459
841 Iterable<Int32x4> getRange(int start, [int end]) { 460 Iterable<Int32x4> getRange(int start, [int end]) {
842 RangeError.checkValidRange(start, end, this.length); 461 RangeError.checkValidRange(start, end, this.length);
843 return new SubListIterable<Int32x4>(this, start, end); 462 return new SubListIterable<Int32x4>(this, start, end);
844 } 463 }
845 464
846 Iterator<Int32x4> get iterator => new _TypedListIterator<Int32x4>(this); 465 Iterator<Int32x4> get iterator => new _TypedListIterator<Int32x4>(this);
847 466
848 List<Int32x4> toList({bool growable: true}) { 467 List<Int32x4> toList({bool growable: true}) {
849 return new List<Int32x4>.from(this, growable: growable); 468 return new List<Int32x4>.from(this, growable: growable);
850 } 469 }
851 470
852 Set<Int32x4> toSet() { 471 Set<Int32x4> toSet() {
853 return new Set<Int32x4>.from(this); 472 return new Set<Int32x4>.from(this);
854 } 473 }
855 } 474 }
856 475
857
858 class _Float64x2ListMixin { 476 class _Float64x2ListMixin {
859 Iterable<Float64x2> where(bool f(int element)) => 477 Iterable<Float64x2> where(bool f(int element)) =>
860 new WhereIterable<Float64x2>(this, f); 478 new WhereIterable<Float64x2>(this, f);
861 479
862 Iterable<Float64x2> take(int n) => new SubListIterable<Float64x2>(this, 0, n); 480 Iterable<Float64x2> take(int n) => new SubListIterable<Float64x2>(this, 0, n);
863 481
864 Iterable<Float64x2> takeWhile(bool test(int element)) => 482 Iterable<Float64x2> takeWhile(bool test(int element)) =>
865 new TakeWhileIterable<Float64x2>(this, test); 483 new TakeWhileIterable<Float64x2>(this, test);
866 484
867 Iterable<Float64x2> skip(int n) => 485 Iterable<Float64x2> skip(int n) =>
868 new SubListIterable<Float64x2>(this, n, null); 486 new SubListIterable<Float64x2>(this, n, null);
869 487
870 Iterable<Float64x2> skipWhile(bool test(element)) => 488 Iterable<Float64x2> skipWhile(bool test(element)) =>
871 new SkipWhileIterable<Float64x2>(this, test); 489 new SkipWhileIterable<Float64x2>(this, test);
872 490
873 Iterable<Float64x2> get reversed => new ReversedListIterable<Float64x2>(this); 491 Iterable<Float64x2> get reversed => new ReversedListIterable<Float64x2>(this);
874 492
875 Map<int, Float64x2> asMap() => new ListMapView<Float64x2>(this); 493 Map<int, Float64x2> asMap() => new ListMapView<Float64x2>(this);
876 494
877 Iterable<Float64x2> getRange(int start, [int end]) { 495 Iterable<Float64x2> getRange(int start, [int end]) {
878 RangeError.checkValidRange(start, end, this.length); 496 RangeError.checkValidRange(start, end, this.length);
879 return new SubListIterable<Float64x2>(this, start, end); 497 return new SubListIterable<Float64x2>(this, start, end);
880 } 498 }
881 499
882 Iterator<Float64x2> get iterator => new _TypedListIterator<Float64x2>(this); 500 Iterator<Float64x2> get iterator => new _TypedListIterator<Float64x2>(this);
883 501
884 List<Float64x2> toList({bool growable: true}) { 502 List<Float64x2> toList({bool growable: true}) {
885 return new List<Float64x2>.from(this, growable: growable); 503 return new List<Float64x2>.from(this, growable: growable);
886 } 504 }
887 505
888 Set<Float64x2> toSet() { 506 Set<Float64x2> toSet() {
889 return new Set<Float64x2>.from(this); 507 return new Set<Float64x2>.from(this);
890 } 508 }
891 } 509 }
892 510
893 511 class _ByteBuffer implements ByteBuffer {
894 class ByteBuffer {
895 final _TypedList _data; 512 final _TypedList _data;
896 513
897 ByteBuffer(this._data); 514 _ByteBuffer(this._data);
898 515
899 factory ByteBuffer._New(data) => new ByteBuffer(data); 516 factory _ByteBuffer._New(data) => new _ByteBuffer(data);
900 517
901 // Forward calls to _data. 518 // Forward calls to _data.
902 int get lengthInBytes => _data.lengthInBytes; 519 int get lengthInBytes => _data.lengthInBytes;
903 int get hashCode => _data.hashCode; 520 int get hashCode => _data.hashCode;
904 bool operator==(Object other) => 521 bool operator ==(Object other) =>
905 (other is ByteBuffer) && identical(_data, other._data); 522 (other is _ByteBuffer) && identical(_data, other._data);
906 523
907 ByteData asByteData([int offsetInBytes = 0, int length]) { 524 ByteData asByteData([int offsetInBytes = 0, int length]) {
908 if (length == null) { 525 if (length == null) {
909 length = this.lengthInBytes - offsetInBytes; 526 length = this.lengthInBytes - offsetInBytes;
910 } 527 }
911 return new _ByteDataView(this._data, offsetInBytes, length); 528 return new _ByteDataView(this._data, offsetInBytes, length);
912 } 529 }
913 530
914 Int8List asInt8List([int offsetInBytes = 0, int length]) { 531 Int8List asInt8List([int offsetInBytes = 0, int length]) {
915 if (length == null) { 532 if (length == null) {
(...skipping 11 matching lines...) Expand all
927 544
928 Uint8ClampedList asUint8ClampedList([int offsetInBytes = 0, int length]) { 545 Uint8ClampedList asUint8ClampedList([int offsetInBytes = 0, int length]) {
929 if (length == null) { 546 if (length == null) {
930 length = this.lengthInBytes - offsetInBytes; 547 length = this.lengthInBytes - offsetInBytes;
931 } 548 }
932 return new _Uint8ClampedArrayView(this, offsetInBytes, length); 549 return new _Uint8ClampedArrayView(this, offsetInBytes, length);
933 } 550 }
934 551
935 Int16List asInt16List([int offsetInBytes = 0, int length]) { 552 Int16List asInt16List([int offsetInBytes = 0, int length]) {
936 if (length == null) { 553 if (length == null) {
937 length = (this.lengthInBytes - offsetInBytes) ~/ 554 length =
938 Int16List.BYTES_PER_ELEMENT; 555 (this.lengthInBytes - offsetInBytes) ~/ Int16List.BYTES_PER_ELEMENT;
939 } 556 }
940 return new _Int16ArrayView(this, offsetInBytes, length); 557 return new _Int16ArrayView(this, offsetInBytes, length);
941 } 558 }
942 559
943 Uint16List asUint16List([int offsetInBytes = 0, int length]) { 560 Uint16List asUint16List([int offsetInBytes = 0, int length]) {
944 if (length == null) { 561 if (length == null) {
945 length = (this.lengthInBytes - offsetInBytes) ~/ 562 length =
946 Uint16List.BYTES_PER_ELEMENT; 563 (this.lengthInBytes - offsetInBytes) ~/ Uint16List.BYTES_PER_ELEMENT;
947 } 564 }
948 return new _Uint16ArrayView(this, offsetInBytes, length); 565 return new _Uint16ArrayView(this, offsetInBytes, length);
949 } 566 }
950 567
951 Int32List asInt32List([int offsetInBytes = 0, int length]) { 568 Int32List asInt32List([int offsetInBytes = 0, int length]) {
952 if (length == null) { 569 if (length == null) {
953 length = (this.lengthInBytes - offsetInBytes) ~/ 570 length =
954 Int32List.BYTES_PER_ELEMENT; 571 (this.lengthInBytes - offsetInBytes) ~/ Int32List.BYTES_PER_ELEMENT;
955 } 572 }
956 return new _Int32ArrayView(this, offsetInBytes, length); 573 return new _Int32ArrayView(this, offsetInBytes, length);
957 } 574 }
958 575
959 Uint32List asUint32List([int offsetInBytes = 0, int length]) { 576 Uint32List asUint32List([int offsetInBytes = 0, int length]) {
960 if (length == null) { 577 if (length == null) {
961 length = (this.lengthInBytes - offsetInBytes) ~/ 578 length =
962 Uint32List.BYTES_PER_ELEMENT; 579 (this.lengthInBytes - offsetInBytes) ~/ Uint32List.BYTES_PER_ELEMENT;
963 } 580 }
964 return new _Uint32ArrayView(this, offsetInBytes, length); 581 return new _Uint32ArrayView(this, offsetInBytes, length);
965 } 582 }
966 583
967 Int64List asInt64List([int offsetInBytes = 0, int length]) { 584 Int64List asInt64List([int offsetInBytes = 0, int length]) {
968 if (length == null) { 585 if (length == null) {
969 length = (this.lengthInBytes - offsetInBytes) ~/ 586 length =
970 Int64List.BYTES_PER_ELEMENT; 587 (this.lengthInBytes - offsetInBytes) ~/ Int64List.BYTES_PER_ELEMENT;
971 } 588 }
972 return new _Int64ArrayView(this, offsetInBytes, length); 589 return new _Int64ArrayView(this, offsetInBytes, length);
973 } 590 }
974 591
975 Uint64List asUint64List([int offsetInBytes = 0, int length]) { 592 Uint64List asUint64List([int offsetInBytes = 0, int length]) {
976 if (length == null) { 593 if (length == null) {
977 length = (this.lengthInBytes - offsetInBytes) ~/ 594 length =
978 Uint64List.BYTES_PER_ELEMENT; 595 (this.lengthInBytes - offsetInBytes) ~/ Uint64List.BYTES_PER_ELEMENT;
979 } 596 }
980 return new _Uint64ArrayView(this, offsetInBytes, length); 597 return new _Uint64ArrayView(this, offsetInBytes, length);
981 } 598 }
982 599
983 Float32List asFloat32List([int offsetInBytes = 0, int length]) { 600 Float32List asFloat32List([int offsetInBytes = 0, int length]) {
984 if (length == null) { 601 if (length == null) {
985 length = (this.lengthInBytes - offsetInBytes) ~/ 602 length =
986 Float32List.BYTES_PER_ELEMENT; 603 (this.lengthInBytes - offsetInBytes) ~/ Float32List.BYTES_PER_ELEMENT;
987 } 604 }
988 return new _Float32ArrayView(this, offsetInBytes, length); 605 return new _Float32ArrayView(this, offsetInBytes, length);
989 } 606 }
990 607
991 Float64List asFloat64List([int offsetInBytes = 0, int length]) { 608 Float64List asFloat64List([int offsetInBytes = 0, int length]) {
992 if (length == null) { 609 if (length == null) {
993 length = (this.lengthInBytes - offsetInBytes) ~/ 610 length =
994 Float64List.BYTES_PER_ELEMENT; 611 (this.lengthInBytes - offsetInBytes) ~/ Float64List.BYTES_PER_ELEMENT;
995 } 612 }
996 return new _Float64ArrayView(this, offsetInBytes, length); 613 return new _Float64ArrayView(this, offsetInBytes, length);
997 } 614 }
998 615
999 Float32x4List asFloat32x4List([int offsetInBytes = 0, int length]) { 616 Float32x4List asFloat32x4List([int offsetInBytes = 0, int length]) {
1000 if (length == null) { 617 if (length == null) {
1001 length = (this.lengthInBytes - offsetInBytes) ~/ 618 length = (this.lengthInBytes - offsetInBytes) ~/
1002 Float32x4List.BYTES_PER_ELEMENT; 619 Float32x4List.BYTES_PER_ELEMENT;
1003 } 620 }
1004 return new _Float32x4ArrayView(this, offsetInBytes, length); 621 return new _Float32x4ArrayView(this, offsetInBytes, length);
1005 } 622 }
1006 623
1007 Int32x4List asInt32x4List([int offsetInBytes = 0, int length]) { 624 Int32x4List asInt32x4List([int offsetInBytes = 0, int length]) {
1008 if (length == null) { 625 if (length == null) {
1009 length = (this.lengthInBytes - offsetInBytes) ~/ 626 length =
1010 Int32x4List.BYTES_PER_ELEMENT; 627 (this.lengthInBytes - offsetInBytes) ~/ Int32x4List.BYTES_PER_ELEMENT;
1011 } 628 }
1012 return new _Int32x4ArrayView(this, offsetInBytes, length); 629 return new _Int32x4ArrayView(this, offsetInBytes, length);
1013 } 630 }
1014 631
1015 Float64x2List asFloat64x2List([int offsetInBytes = 0, int length]) { 632 Float64x2List asFloat64x2List([int offsetInBytes = 0, int length]) {
1016 if (length == null) { 633 if (length == null) {
1017 length = (this.lengthInBytes - offsetInBytes) ~/ 634 length = (this.lengthInBytes - offsetInBytes) ~/
1018 Float64x2List.BYTES_PER_ELEMENT; 635 Float64x2List.BYTES_PER_ELEMENT;
1019 } 636 }
1020 return new _Float64x2ArrayView(this, offsetInBytes, length); 637 return new _Float64x2ArrayView(this, offsetInBytes, length);
1021 } 638 }
1022 } 639 }
1023 640
1024
1025 abstract class _TypedList extends _TypedListBase { 641 abstract class _TypedList extends _TypedListBase {
1026 // Default method implementing parts of the TypedData interface. 642 // Default method implementing parts of the TypedData interface.
1027 int get offsetInBytes { 643 int get offsetInBytes {
1028 return 0; 644 return 0;
1029 } 645 }
1030 646
1031 int get lengthInBytes { 647 int get lengthInBytes {
1032 return length * elementSizeInBytes; 648 return length * elementSizeInBytes;
1033 } 649 }
1034 650
1035 ByteBuffer get buffer => new ByteBuffer(this); 651 _ByteBuffer get buffer => new _ByteBuffer(this);
1036 652
1037 // Methods implementing the collection interface. 653 // Methods implementing the collection interface.
1038 654
1039 int get length native "TypedData_length"; 655 int get length native "TypedData_length";
1040 656
1041 // Internal utility methods. 657 // Internal utility methods.
1042 658
1043 int _getInt8(int offsetInBytes) native "TypedData_GetInt8"; 659 int _getInt8(int offsetInBytes) native "TypedData_GetInt8";
1044 void _setInt8(int offsetInBytes, int value) native "TypedData_SetInt8"; 660 void _setInt8(int offsetInBytes, int value) native "TypedData_SetInt8";
1045 661
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 native "TypedData_SetInt32x4"; 697 native "TypedData_SetInt32x4";
1082 698
1083 Float64x2 _getFloat64x2(int offsetInBytes) native "TypedData_GetFloat64x2"; 699 Float64x2 _getFloat64x2(int offsetInBytes) native "TypedData_GetFloat64x2";
1084 void _setFloat64x2(int offsetInBytes, Float64x2 value) 700 void _setFloat64x2(int offsetInBytes, Float64x2 value)
1085 native "TypedData_SetFloat64x2"; 701 native "TypedData_SetFloat64x2";
1086 702
1087 /** 703 /**
1088 * Stores the [CodeUnits] as UTF-16 units into this TypedData at 704 * Stores the [CodeUnits] as UTF-16 units into this TypedData at
1089 * positions [start]..[end] (uint16 indices). 705 * positions [start]..[end] (uint16 indices).
1090 */ 706 */
1091 void _setCodeUnits(CodeUnits units, 707 void _setCodeUnits(
1092 int byteStart, int length, int skipCount) { 708 CodeUnits units, int byteStart, int length, int skipCount) {
1093 assert(byteStart + length * Uint16List.BYTES_PER_ELEMENT <= lengthInBytes); 709 assert(byteStart + length * Uint16List.BYTES_PER_ELEMENT <= lengthInBytes);
1094 String string = CodeUnits.stringOf(units); 710 String string = CodeUnits.stringOf(units);
1095 int sliceEnd = skipCount + length; 711 int sliceEnd = skipCount + length;
1096 RangeError.checkValidRange(skipCount, sliceEnd, 712 RangeError.checkValidRange(
1097 string.length, 713 skipCount, sliceEnd, string.length, "skipCount", "skipCount + length");
1098 "skipCount", "skipCount + length");
1099 for (int i = 0; i < length; i++) { 714 for (int i = 0; i < length; i++) {
1100 _setUint16(byteStart + i * Uint16List.BYTES_PER_ELEMENT, 715 _setUint16(byteStart + i * Uint16List.BYTES_PER_ELEMENT,
1101 string.codeUnitAt(skipCount + i)); 716 string.codeUnitAt(skipCount + i));
1102 } 717 }
1103 } 718 }
1104 } 719 }
1105 720
1106 721 @patch
1107 class Int8List extends _TypedList with _IntListMixin implements List<int>, Typed Data { 722 class Int8List {
1108 // Factory constructors. 723 @patch
1109
1110 factory Int8List(int length) native "TypedData_Int8Array_new"; 724 factory Int8List(int length) native "TypedData_Int8Array_new";
1111 725
726 @patch
1112 factory Int8List.fromList(List<int> elements) { 727 factory Int8List.fromList(List<int> elements) {
1113 return new Int8List(elements.length) 728 return new Int8List(elements.length)
1114 ..setRange(0, elements.length, elements); 729 ..setRange(0, elements.length, elements);
1115 } 730 }
731 }
1116 732
1117 factory Int8List.view(ByteBuffer buffer, 733 class _Int8List extends _TypedList with _IntListMixin implements Int8List {
1118 [int offsetInBytes = 0, int length]) { 734 Type get runtimeType => Int8List;
1119 return buffer.asInt8List(offsetInBytes, length);
1120 }
1121 735
1122 // Method(s) implementing List interface. 736 // Method(s) implementing List interface.
1123 737 int operator [](int index) {
1124 int operator[](int index) {
1125 if (index < 0 || index >= length) { 738 if (index < 0 || index >= length) {
1126 throw new RangeError.index(index, this, "index"); 739 throw new RangeError.index(index, this, "index");
1127 } 740 }
1128 return _getInt8(index); 741 return _getInt8(index);
1129 } 742 }
1130 743
1131 void operator[]=(int index, int value) { 744 void operator []=(int index, int value) {
1132 if (index < 0 || index >= length) { 745 if (index < 0 || index >= length) {
1133 throw new RangeError.index(index, this, "index"); 746 throw new RangeError.index(index, this, "index");
1134 } 747 }
1135 _setInt8(index, _toInt8(value)); 748 _setInt8(index, _toInt8(value));
1136 } 749 }
1137 750
1138 static const int BYTES_PER_ELEMENT = 1;
1139
1140 // Method(s) implementing TypedData interface. 751 // Method(s) implementing TypedData interface.
1141
1142 int get elementSizeInBytes { 752 int get elementSizeInBytes {
1143 return Int8List.BYTES_PER_ELEMENT; 753 return Int8List.BYTES_PER_ELEMENT;
1144 } 754 }
1145 755
1146
1147 // Internal utility methods. 756 // Internal utility methods.
1148
1149 Int8List _createList(int length) { 757 Int8List _createList(int length) {
1150 return new Int8List(length); 758 return new Int8List(length);
1151 } 759 }
1152 } 760 }
1153 761
1154 762 @patch
1155 class Uint8List extends _TypedList with _IntListMixin implements List<int>, Type dData { 763 class Uint8List {
1156 // Factory constructors. 764 @patch
1157
1158 factory Uint8List(int length) native "TypedData_Uint8Array_new"; 765 factory Uint8List(int length) native "TypedData_Uint8Array_new";
1159 766
767 @patch
1160 factory Uint8List.fromList(List<int> elements) { 768 factory Uint8List.fromList(List<int> elements) {
1161 return new Uint8List(elements.length) 769 return new Uint8List(elements.length)
1162 ..setRange(0, elements.length, elements); 770 ..setRange(0, elements.length, elements);
1163 } 771 }
772 }
1164 773
1165 factory Uint8List.view(ByteBuffer buffer, 774 class _Uint8List extends _TypedList with _IntListMixin implements Uint8List {
1166 [int offsetInBytes = 0, int length]) { 775 Type get runtimeType => Uint8List;
1167 return buffer.asUint8List(offsetInBytes, length);
1168 }
1169 776
1170 // Methods implementing List interface. 777 // Methods implementing List interface.
1171 int operator[](int index) { 778 int operator [](int index) {
1172 if (index < 0 || index >= length) { 779 if (index < 0 || index >= length) {
1173 throw new RangeError.index(index, this, "index"); 780 throw new RangeError.index(index, this, "index");
1174 } 781 }
1175 return _getUint8(index); 782 return _getUint8(index);
1176 } 783 }
1177 784
1178 void operator[]=(int index, int value) { 785 void operator []=(int index, int value) {
1179 if (index < 0 || index >= length) { 786 if (index < 0 || index >= length) {
1180 throw new RangeError.index(index, this, "index"); 787 throw new RangeError.index(index, this, "index");
1181 } 788 }
1182 _setUint8(index, _toUint8(value)); 789 _setUint8(index, _toUint8(value));
1183 } 790 }
1184 791
1185 static const int BYTES_PER_ELEMENT = 1;
1186
1187 // Methods implementing TypedData interface. 792 // Methods implementing TypedData interface.
1188 int get elementSizeInBytes { 793 int get elementSizeInBytes {
1189 return Uint8List.BYTES_PER_ELEMENT; 794 return Uint8List.BYTES_PER_ELEMENT;
1190 } 795 }
1191 796
1192 // Internal utility methods. 797 // Internal utility methods.
1193
1194 Uint8List _createList(int length) { 798 Uint8List _createList(int length) {
1195 return new Uint8List(length); 799 return new Uint8List(length);
1196 } 800 }
1197 } 801 }
1198 802
1199 803 @patch
1200 class Uint8ClampedList extends _TypedList with _IntListMixin implements List<int >, TypedData { 804 class Uint8ClampedList {
1201 // Factory constructors. 805 @patch
1202
1203 factory Uint8ClampedList(int length) native "TypedData_Uint8ClampedArray_new"; 806 factory Uint8ClampedList(int length) native "TypedData_Uint8ClampedArray_new";
1204 807
808 @patch
1205 factory Uint8ClampedList.fromList(List<int> elements) { 809 factory Uint8ClampedList.fromList(List<int> elements) {
1206 return new Uint8ClampedList(elements.length) 810 return new Uint8ClampedList(elements.length)
1207 ..setRange(0, elements.length, elements); 811 ..setRange(0, elements.length, elements);
1208 } 812 }
813 }
1209 814
1210 factory Uint8ClampedList.view(ByteBuffer buffer, 815 class _Uint8ClampedList extends _TypedList
1211 [int offsetInBytes = 0, int length]) { 816 with _IntListMixin
1212 return buffer.asUint8ClampedList(offsetInBytes, length); 817 implements Uint8ClampedList {
1213 } 818 Type get runtimeType => Uint8ClampedList;
1214 819
1215 // Methods implementing List interface. 820 // Methods implementing List interface.
1216 821 int operator [](int index) {
1217 int operator[](int index) {
1218 if (index < 0 || index >= length) { 822 if (index < 0 || index >= length) {
1219 throw new RangeError.index(index, this, "index"); 823 throw new RangeError.index(index, this, "index");
1220 } 824 }
1221 return _getUint8(index); 825 return _getUint8(index);
1222 } 826 }
1223 827
1224 void operator[]=(int index, int value) { 828 void operator []=(int index, int value) {
1225 if (index < 0 || index >= length) { 829 if (index < 0 || index >= length) {
1226 throw new RangeError.index(index, this, "index"); 830 throw new RangeError.index(index, this, "index");
1227 } 831 }
1228 _setUint8(index, _toClampedUint8(value)); 832 _setUint8(index, _toClampedUint8(value));
1229 } 833 }
1230 834
1231 static const int BYTES_PER_ELEMENT = 1;
1232
1233 // Methods implementing TypedData interface. 835 // Methods implementing TypedData interface.
1234 int get elementSizeInBytes { 836 int get elementSizeInBytes {
1235 return Uint8List.BYTES_PER_ELEMENT; 837 return Uint8List.BYTES_PER_ELEMENT;
1236 } 838 }
1237 839
1238
1239 // Internal utility methods. 840 // Internal utility methods.
1240
1241 Uint8ClampedList _createList(int length) { 841 Uint8ClampedList _createList(int length) {
1242 return new Uint8ClampedList(length); 842 return new Uint8ClampedList(length);
1243 } 843 }
1244 } 844 }
1245 845
1246 846 @patch
1247 class Int16List extends _TypedList with _IntListMixin implements List<int>, Type dData { 847 class Int16List {
1248 // Factory constructors. 848 @patch
1249
1250 factory Int16List(int length) native "TypedData_Int16Array_new"; 849 factory Int16List(int length) native "TypedData_Int16Array_new";
1251 850
851 @patch
1252 factory Int16List.fromList(List<int> elements) { 852 factory Int16List.fromList(List<int> elements) {
1253 return new Int16List(elements.length) 853 return new Int16List(elements.length)
1254 ..setRange(0, elements.length, elements); 854 ..setRange(0, elements.length, elements);
1255 } 855 }
856 }
1256 857
1257 factory Int16List.view(ByteBuffer buffer, 858 class _Int16List extends _TypedList with _IntListMixin implements Int16List {
1258 [int offsetInBytes = 0, int length]) { 859 Type get runtimeType => Int16List;
1259 return buffer.asInt16List(offsetInBytes, length);
1260 }
1261 860
1262 // Method(s) implementing List interface. 861 // Method(s) implementing List interface.
1263 862 int operator [](int index) {
1264 int operator[](int index) {
1265 if (index < 0 || index >= length) { 863 if (index < 0 || index >= length) {
1266 throw new RangeError.index(index, this, "index"); 864 throw new RangeError.index(index, this, "index");
1267 } 865 }
1268 return _getIndexedInt16(index); 866 return _getIndexedInt16(index);
1269 } 867 }
1270 868
1271 void operator[]=(int index, int value) { 869 void operator []=(int index, int value) {
1272 if (index < 0 || index >= length) { 870 if (index < 0 || index >= length) {
1273 throw new RangeError.index(index, this, "index"); 871 throw new RangeError.index(index, this, "index");
1274 } 872 }
1275 _setIndexedInt16(index, _toInt16(value)); 873 _setIndexedInt16(index, _toInt16(value));
1276 } 874 }
1277 875
1278 void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) { 876 void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) {
1279 if (iterable is CodeUnits) { 877 if (iterable is CodeUnits) {
1280 end = RangeError.checkValidRange(start, end, this.length); 878 end = RangeError.checkValidRange(start, end, this.length);
1281 int length = end - start; 879 int length = end - start;
1282 int byteStart = this.offsetInBytes + start * Int16List.BYTES_PER_ELEMENT; 880 int byteStart = this.offsetInBytes + start * Int16List.BYTES_PER_ELEMENT;
1283 _setCodeUnits(iterable, byteStart, length, skipCount); 881 _setCodeUnits(iterable, byteStart, length, skipCount);
1284 } else { 882 } else {
1285 super.setRange(start, end, iterable, skipCount); 883 super.setRange(start, end, iterable, skipCount);
1286 } 884 }
1287 } 885 }
1288 886
1289 // Method(s) implementing TypedData interface. 887 // Method(s) implementing TypedData interface.
1290 static const int BYTES_PER_ELEMENT = 2;
1291
1292 int get elementSizeInBytes { 888 int get elementSizeInBytes {
1293 return Int16List.BYTES_PER_ELEMENT; 889 return Int16List.BYTES_PER_ELEMENT;
1294 } 890 }
1295 891
1296
1297 // Internal utility methods. 892 // Internal utility methods.
1298
1299 Int16List _createList(int length) { 893 Int16List _createList(int length) {
1300 return new Int16List(length); 894 return new Int16List(length);
1301 } 895 }
1302 896
1303 int _getIndexedInt16(int index) { 897 int _getIndexedInt16(int index) {
1304 return _getInt16(index * Int16List.BYTES_PER_ELEMENT); 898 return _getInt16(index * Int16List.BYTES_PER_ELEMENT);
1305 } 899 }
1306 900
1307 void _setIndexedInt16(int index, int value) { 901 void _setIndexedInt16(int index, int value) {
1308 _setInt16(index * Int16List.BYTES_PER_ELEMENT, value); 902 _setInt16(index * Int16List.BYTES_PER_ELEMENT, value);
1309 } 903 }
1310 } 904 }
1311 905
1312 906 @patch
1313 class Uint16List extends _TypedList with _IntListMixin implements List<int>, Typ edData { 907 class Uint16List {
1314 // Factory constructors. 908 @patch
1315
1316 factory Uint16List(int length) native "TypedData_Uint16Array_new"; 909 factory Uint16List(int length) native "TypedData_Uint16Array_new";
1317 910
911 @patch
1318 factory Uint16List.fromList(List<int> elements) { 912 factory Uint16List.fromList(List<int> elements) {
1319 return new Uint16List(elements.length) 913 return new Uint16List(elements.length)
1320 ..setRange(0, elements.length, elements); 914 ..setRange(0, elements.length, elements);
1321 } 915 }
916 }
1322 917
1323 factory Uint16List.view(ByteBuffer buffer, 918 class _Uint16List extends _TypedList with _IntListMixin implements Uint16List {
1324 [int offsetInBytes = 0, int length]) { 919 Type get runtimeType => Uint16List;
1325 return buffer.asUint16List(offsetInBytes, length);
1326 }
1327 920
1328 // Method(s) implementing the List interface. 921 // Method(s) implementing the List interface.
1329 922 int operator [](int index) {
1330 int operator[](int index) {
1331 if (index < 0 || index >= length) { 923 if (index < 0 || index >= length) {
1332 throw new RangeError.index(index, this, "index"); 924 throw new RangeError.index(index, this, "index");
1333 } 925 }
1334 return _getIndexedUint16(index); 926 return _getIndexedUint16(index);
1335 } 927 }
1336 928
1337 void operator[]=(int index, int value) { 929 void operator []=(int index, int value) {
1338 if (index < 0 || index >= length) { 930 if (index < 0 || index >= length) {
1339 throw new RangeError.index(index, this, "index"); 931 throw new RangeError.index(index, this, "index");
1340 } 932 }
1341 _setIndexedUint16(index, _toUint16(value)); 933 _setIndexedUint16(index, _toUint16(value));
1342 } 934 }
1343 935
1344 void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) { 936 void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) {
1345 if (iterable is CodeUnits) { 937 if (iterable is CodeUnits) {
1346 end = RangeError.checkValidRange(start, end, this.length); 938 end = RangeError.checkValidRange(start, end, this.length);
1347 int length = end - start; 939 int length = end - start;
1348 int byteStart = this.offsetInBytes + start * Uint16List.BYTES_PER_ELEMENT; 940 int byteStart = this.offsetInBytes + start * Uint16List.BYTES_PER_ELEMENT;
1349 _setCodeUnits(iterable, byteStart, length, skipCount); 941 _setCodeUnits(iterable, byteStart, length, skipCount);
1350 } else { 942 } else {
1351 super.setRange(start, end, iterable, skipCount); 943 super.setRange(start, end, iterable, skipCount);
1352 } 944 }
1353 } 945 }
1354 946
1355 // Method(s) implementing the TypedData interface. 947 // Method(s) implementing the TypedData interface.
1356 static const int BYTES_PER_ELEMENT = 2;
1357
1358 int get elementSizeInBytes { 948 int get elementSizeInBytes {
1359 return Uint16List.BYTES_PER_ELEMENT; 949 return Uint16List.BYTES_PER_ELEMENT;
1360 } 950 }
1361 951
1362
1363 // Internal utility methods. 952 // Internal utility methods.
1364
1365 Uint16List _createList(int length) { 953 Uint16List _createList(int length) {
1366 return new Uint16List(length); 954 return new Uint16List(length);
1367 } 955 }
1368 956
1369 int _getIndexedUint16(int index) { 957 int _getIndexedUint16(int index) {
1370 return _getUint16(index * Uint16List.BYTES_PER_ELEMENT); 958 return _getUint16(index * Uint16List.BYTES_PER_ELEMENT);
1371 } 959 }
1372 960
1373 void _setIndexedUint16(int index, int value) { 961 void _setIndexedUint16(int index, int value) {
1374 _setUint16(index * Uint16List.BYTES_PER_ELEMENT, value); 962 _setUint16(index * Uint16List.BYTES_PER_ELEMENT, value);
1375 } 963 }
1376 } 964 }
1377 965
1378 966 @patch
1379 class Int32List extends _TypedList with _IntListMixin implements List<int>, Type dData { 967 class Int32List {
1380 // Factory constructors. 968 @patch
1381
1382 factory Int32List(int length) native "TypedData_Int32Array_new"; 969 factory Int32List(int length) native "TypedData_Int32Array_new";
1383 970
971 @patch
1384 factory Int32List.fromList(List<int> elements) { 972 factory Int32List.fromList(List<int> elements) {
1385 return new Int32List(elements.length) 973 return new Int32List(elements.length)
1386 ..setRange(0, elements.length, elements); 974 ..setRange(0, elements.length, elements);
1387 } 975 }
976 }
1388 977
1389 factory Int32List.view(ByteBuffer buffer, 978 class _Int32List extends _TypedList with _IntListMixin implements Int32List {
1390 [int offsetInBytes = 0, int length]) { 979 Type get runtimeType => Int32List;
1391 return buffer.asInt32List(offsetInBytes, length);
1392 }
1393 980
1394 // Method(s) implementing the List interface. 981 // Method(s) implementing the List interface.
1395 982 int operator [](int index) {
1396 int operator[](int index) {
1397 if (index < 0 || index >= length) { 983 if (index < 0 || index >= length) {
1398 throw new RangeError.index(index, this, "index"); 984 throw new RangeError.index(index, this, "index");
1399 } 985 }
1400 return _getIndexedInt32(index); 986 return _getIndexedInt32(index);
1401 } 987 }
1402 988
1403 void operator[]=(int index, int value) { 989 void operator []=(int index, int value) {
1404 if (index < 0 || index >= length) { 990 if (index < 0 || index >= length) {
1405 throw new RangeError.index(index, this, "index"); 991 throw new RangeError.index(index, this, "index");
1406 } 992 }
1407 _setIndexedInt32(index, _toInt32(value)); 993 _setIndexedInt32(index, _toInt32(value));
1408 } 994 }
1409 995
1410
1411 // Method(s) implementing TypedData interface. 996 // Method(s) implementing TypedData interface.
1412 static const int BYTES_PER_ELEMENT = 4;
1413
1414 int get elementSizeInBytes { 997 int get elementSizeInBytes {
1415 return Int32List.BYTES_PER_ELEMENT; 998 return Int32List.BYTES_PER_ELEMENT;
1416 } 999 }
1417 1000
1418
1419 // Internal utility methods. 1001 // Internal utility methods.
1420
1421 Int32List _createList(int length) { 1002 Int32List _createList(int length) {
1422 return new Int32List(length); 1003 return new Int32List(length);
1423 } 1004 }
1424 1005
1425 int _getIndexedInt32(int index) { 1006 int _getIndexedInt32(int index) {
1426 return _getInt32(index * Int32List.BYTES_PER_ELEMENT); 1007 return _getInt32(index * Int32List.BYTES_PER_ELEMENT);
1427 } 1008 }
1428 1009
1429 void _setIndexedInt32(int index, int value) { 1010 void _setIndexedInt32(int index, int value) {
1430 _setInt32(index * Int32List.BYTES_PER_ELEMENT, value); 1011 _setInt32(index * Int32List.BYTES_PER_ELEMENT, value);
1431 } 1012 }
1432
1433 } 1013 }
1434 1014
1435 1015 @patch
1436 class Uint32List extends _TypedList with _IntListMixin implements List<int>, Typ edData { 1016 class Uint32List {
1437 // Factory constructors. 1017 @patch
1438
1439 factory Uint32List(int length) native "TypedData_Uint32Array_new"; 1018 factory Uint32List(int length) native "TypedData_Uint32Array_new";
1440 1019
1020 @patch
1441 factory Uint32List.fromList(List<int> elements) { 1021 factory Uint32List.fromList(List<int> elements) {
1442 return new Uint32List(elements.length) 1022 return new Uint32List(elements.length)
1443 ..setRange(0, elements.length, elements); 1023 ..setRange(0, elements.length, elements);
1444 } 1024 }
1025 }
1445 1026
1446 factory Uint32List.view(ByteBuffer buffer, 1027 class _Uint32List extends _TypedList with _IntListMixin implements Uint32List {
1447 [int offsetInBytes = 0, int length]) { 1028 Type get runtimeType => Uint32List;
1448 return buffer.asUint32List(offsetInBytes, length);
1449 }
1450 1029
1451 // Method(s) implementing the List interface. 1030 // Method(s) implementing the List interface.
1452 1031 int operator [](int index) {
1453 int operator[](int index) {
1454 if (index < 0 || index >= length) { 1032 if (index < 0 || index >= length) {
1455 throw new RangeError.index(index, this, "index"); 1033 throw new RangeError.index(index, this, "index");
1456 } 1034 }
1457 return _getIndexedUint32(index); 1035 return _getIndexedUint32(index);
1458 } 1036 }
1459 1037
1460 void operator[]=(int index, int value) { 1038 void operator []=(int index, int value) {
1461 if (index < 0 || index >= length) { 1039 if (index < 0 || index >= length) {
1462 throw new RangeError.index(index, this, "index"); 1040 throw new RangeError.index(index, this, "index");
1463 } 1041 }
1464 _setIndexedUint32(index, _toUint32(value)); 1042 _setIndexedUint32(index, _toUint32(value));
1465 } 1043 }
1466 1044
1467
1468 // Method(s) implementing the TypedData interface. 1045 // Method(s) implementing the TypedData interface.
1469 static const int BYTES_PER_ELEMENT = 4;
1470
1471 int get elementSizeInBytes { 1046 int get elementSizeInBytes {
1472 return Uint32List.BYTES_PER_ELEMENT; 1047 return Uint32List.BYTES_PER_ELEMENT;
1473 } 1048 }
1474 1049
1475
1476 // Internal utility methods. 1050 // Internal utility methods.
1477
1478 Uint32List _createList(int length) { 1051 Uint32List _createList(int length) {
1479 return new Uint32List(length); 1052 return new Uint32List(length);
1480 } 1053 }
1481 1054
1482 int _getIndexedUint32(int index) { 1055 int _getIndexedUint32(int index) {
1483 return _getUint32(index * Uint32List.BYTES_PER_ELEMENT); 1056 return _getUint32(index * Uint32List.BYTES_PER_ELEMENT);
1484 } 1057 }
1485 1058
1486 void _setIndexedUint32(int index, int value) { 1059 void _setIndexedUint32(int index, int value) {
1487 _setUint32(index * Uint32List.BYTES_PER_ELEMENT, value); 1060 _setUint32(index * Uint32List.BYTES_PER_ELEMENT, value);
1488 } 1061 }
1489 } 1062 }
1490 1063
1491 1064 @patch
1492 class Int64List extends _TypedList with _IntListMixin implements List<int>, Type dData { 1065 class Int64List {
1493 // Factory constructors. 1066 @patch
1494
1495 factory Int64List(int length) native "TypedData_Int64Array_new"; 1067 factory Int64List(int length) native "TypedData_Int64Array_new";
1496 1068
1069 @patch
1497 factory Int64List.fromList(List<int> elements) { 1070 factory Int64List.fromList(List<int> elements) {
1498 return new Int64List(elements.length) 1071 return new Int64List(elements.length)
1499 ..setRange(0, elements.length, elements); 1072 ..setRange(0, elements.length, elements);
1500 } 1073 }
1074 }
1501 1075
1502 factory Int64List.view(ByteBuffer buffer, 1076 class _Int64List extends _TypedList with _IntListMixin implements Int64List {
1503 [int offsetInBytes = 0, int length]) { 1077 Type get runtimeType => Int64List;
1504 return buffer.asInt64List(offsetInBytes, length);
1505 }
1506 1078
1507 // Method(s) implementing the List interface. 1079 // Method(s) implementing the List interface.
1508 1080 int operator [](int index) {
1509 int operator[](int index) {
1510 if (index < 0 || index >= length) { 1081 if (index < 0 || index >= length) {
1511 throw new RangeError.index(index, this, "index"); 1082 throw new RangeError.index(index, this, "index");
1512 } 1083 }
1513 return _getIndexedInt64(index); 1084 return _getIndexedInt64(index);
1514 } 1085 }
1515 1086
1516 void operator[]=(int index, int value) { 1087 void operator []=(int index, int value) {
1517 if (index < 0 || index >= length) { 1088 if (index < 0 || index >= length) {
1518 throw new RangeError.index(index, this, "index"); 1089 throw new RangeError.index(index, this, "index");
1519 } 1090 }
1520 _setIndexedInt64(index, _toInt64(value)); 1091 _setIndexedInt64(index, _toInt64(value));
1521 } 1092 }
1522 1093
1523
1524 // Method(s) implementing the TypedData interface. 1094 // Method(s) implementing the TypedData interface.
1525 static const int BYTES_PER_ELEMENT = 8;
1526
1527 int get elementSizeInBytes { 1095 int get elementSizeInBytes {
1528 return Int64List.BYTES_PER_ELEMENT; 1096 return Int64List.BYTES_PER_ELEMENT;
1529 } 1097 }
1530 1098
1531
1532 // Internal utility methods. 1099 // Internal utility methods.
1533
1534 Int64List _createList(int length) { 1100 Int64List _createList(int length) {
1535 return new Int64List(length); 1101 return new Int64List(length);
1536 } 1102 }
1537 1103
1538 int _getIndexedInt64(int index) { 1104 int _getIndexedInt64(int index) {
1539 return _getInt64(index * Int64List.BYTES_PER_ELEMENT); 1105 return _getInt64(index * Int64List.BYTES_PER_ELEMENT);
1540 } 1106 }
1541 1107
1542 void _setIndexedInt64(int index, int value) { 1108 void _setIndexedInt64(int index, int value) {
1543 _setInt64(index * Int64List.BYTES_PER_ELEMENT, value); 1109 _setInt64(index * Int64List.BYTES_PER_ELEMENT, value);
1544 } 1110 }
1545 } 1111 }
1546 1112
1547 1113 @patch
1548 class Uint64List extends _TypedList with _IntListMixin implements List<int>, Typ edData { 1114 class Uint64List {
1549 // Factory constructors. 1115 @patch
1550
1551 factory Uint64List(int length) native "TypedData_Uint64Array_new"; 1116 factory Uint64List(int length) native "TypedData_Uint64Array_new";
1552 1117
1118 @patch
1553 factory Uint64List.fromList(List<int> elements) { 1119 factory Uint64List.fromList(List<int> elements) {
1554 return new Uint64List(elements.length) 1120 return new Uint64List(elements.length)
1555 ..setRange(0, elements.length, elements); 1121 ..setRange(0, elements.length, elements);
1556 } 1122 }
1123 }
1557 1124
1558 factory Uint64List.view(ByteBuffer buffer, 1125 class _Uint64List extends _TypedList with _IntListMixin implements Uint64List {
1559 [int offsetInBytes = 0, int length]) { 1126 Type get runtimeType => Uint64List;
1560 return buffer.asUint64List(offsetInBytes, length);
1561 }
1562 1127
1563 // Method(s) implementing the List interface. 1128 // Method(s) implementing the List interface.
1564 1129 int operator [](int index) {
1565 int operator[](int index) {
1566 if (index < 0 || index >= length) { 1130 if (index < 0 || index >= length) {
1567 throw new RangeError.index(index, this, "index"); 1131 throw new RangeError.index(index, this, "index");
1568 } 1132 }
1569 return _getIndexedUint64(index); 1133 return _getIndexedUint64(index);
1570 } 1134 }
1571 1135
1572 void operator[]=(int index, int value) { 1136 void operator []=(int index, int value) {
1573 if (index < 0 || index >= length) { 1137 if (index < 0 || index >= length) {
1574 throw new RangeError.index(index, this, "index"); 1138 throw new RangeError.index(index, this, "index");
1575 } 1139 }
1576 _setIndexedUint64(index, _toUint64(value)); 1140 _setIndexedUint64(index, _toUint64(value));
1577 } 1141 }
1578 1142
1579
1580 // Method(s) implementing the TypedData interface. 1143 // Method(s) implementing the TypedData interface.
1581 static const int BYTES_PER_ELEMENT = 8;
1582
1583 int get elementSizeInBytes { 1144 int get elementSizeInBytes {
1584 return Uint64List.BYTES_PER_ELEMENT; 1145 return Uint64List.BYTES_PER_ELEMENT;
1585 } 1146 }
1586 1147
1587
1588 // Internal utility methods. 1148 // Internal utility methods.
1589
1590 Uint64List _createList(int length) { 1149 Uint64List _createList(int length) {
1591 return new Uint64List(length); 1150 return new Uint64List(length);
1592 } 1151 }
1593 1152
1594 int _getIndexedUint64(int index) { 1153 int _getIndexedUint64(int index) {
1595 return _getUint64(index * Uint64List.BYTES_PER_ELEMENT); 1154 return _getUint64(index * Uint64List.BYTES_PER_ELEMENT);
1596 } 1155 }
1597 1156
1598 void _setIndexedUint64(int index, int value) { 1157 void _setIndexedUint64(int index, int value) {
1599 _setUint64(index * Uint64List.BYTES_PER_ELEMENT, value); 1158 _setUint64(index * Uint64List.BYTES_PER_ELEMENT, value);
1600 } 1159 }
1601 } 1160 }
1602 1161
1603 1162 @patch
1604 class Float32List extends _TypedList with _DoubleListMixin implements List<doubl e>, TypedData { 1163 class Float32List {
1605 // Factory constructors. 1164 @patch
1606
1607 factory Float32List(int length) native "TypedData_Float32Array_new"; 1165 factory Float32List(int length) native "TypedData_Float32Array_new";
1608 1166
1167 @patch
1609 factory Float32List.fromList(List<double> elements) { 1168 factory Float32List.fromList(List<double> elements) {
1610 return new Float32List(elements.length) 1169 return new Float32List(elements.length)
1611 ..setRange(0, elements.length, elements); 1170 ..setRange(0, elements.length, elements);
1612 } 1171 }
1172 }
1613 1173
1614 factory Float32List.view(ByteBuffer buffer, 1174 class _Float32List extends _TypedList
1615 [int offsetInBytes = 0, int length]) { 1175 with _DoubleListMixin
1616 return buffer.asFloat32List(offsetInBytes, length); 1176 implements Float32List {
1617 } 1177 Type get runtimeType => Float32List;
1618 1178
1619 // Method(s) implementing the List interface. 1179 // Method(s) implementing the List interface.
1620 1180 double operator [](int index) {
1621 double operator[](int index) {
1622 if (index < 0 || index >= length) { 1181 if (index < 0 || index >= length) {
1623 throw new RangeError.index(index, this, "index"); 1182 throw new RangeError.index(index, this, "index");
1624 } 1183 }
1625 return _getIndexedFloat32(index); 1184 return _getIndexedFloat32(index);
1626 } 1185 }
1627 1186
1628 void operator[]=(int index, double value) { 1187 void operator []=(int index, double value) {
1629 if (index < 0 || index >= length) { 1188 if (index < 0 || index >= length) {
1630 throw new RangeError.index(index, this, "index"); 1189 throw new RangeError.index(index, this, "index");
1631 } 1190 }
1632 _setIndexedFloat32(index, value); 1191 _setIndexedFloat32(index, value);
1633 } 1192 }
1634 1193
1635
1636 // Method(s) implementing the TypedData interface. 1194 // Method(s) implementing the TypedData interface.
1637 static const int BYTES_PER_ELEMENT = 4;
1638
1639 int get elementSizeInBytes { 1195 int get elementSizeInBytes {
1640 return Float32List.BYTES_PER_ELEMENT; 1196 return Float32List.BYTES_PER_ELEMENT;
1641 } 1197 }
1642 1198
1643
1644 // Internal utility methods. 1199 // Internal utility methods.
1645
1646 Float32List _createList(int length) { 1200 Float32List _createList(int length) {
1647 return new Float32List(length); 1201 return new Float32List(length);
1648 } 1202 }
1649 1203
1650 double _getIndexedFloat32(int index) { 1204 double _getIndexedFloat32(int index) {
1651 return _getFloat32(index * Float32List.BYTES_PER_ELEMENT); 1205 return _getFloat32(index * Float32List.BYTES_PER_ELEMENT);
1652 } 1206 }
1653 1207
1654 void _setIndexedFloat32(int index, double value) { 1208 void _setIndexedFloat32(int index, double value) {
1655 _setFloat32(index * Float32List.BYTES_PER_ELEMENT, value); 1209 _setFloat32(index * Float32List.BYTES_PER_ELEMENT, value);
1656 } 1210 }
1657 } 1211 }
1658 1212
1659 1213 @patch
1660 class Float64List extends _TypedList with _DoubleListMixin implements List<doubl e>, TypedData { 1214 class Float64List {
1661 // Factory constructors. 1215 @patch
1662
1663 factory Float64List(int length) native "TypedData_Float64Array_new"; 1216 factory Float64List(int length) native "TypedData_Float64Array_new";
1664 1217
1218 @patch
1665 factory Float64List.fromList(List<double> elements) { 1219 factory Float64List.fromList(List<double> elements) {
1666 return new Float64List(elements.length) 1220 return new Float64List(elements.length)
1667 ..setRange(0, elements.length, elements); 1221 ..setRange(0, elements.length, elements);
1668 } 1222 }
1223 }
1669 1224
1670 factory Float64List.view(ByteBuffer buffer, 1225 class _Float64List extends _TypedList
1671 [int offsetInBytes = 0, int length]) { 1226 with _DoubleListMixin
1672 return buffer.asFloat64List(offsetInBytes, length); 1227 implements Float64List {
1673 } 1228 Type get runtimeType => Float64List;
1674 1229
1675 // Method(s) implementing the List interface. 1230 // Method(s) implementing the List interface.
1676 1231 double operator [](int index) {
1677 double operator[](int index) {
1678 if (index < 0 || index >= length) { 1232 if (index < 0 || index >= length) {
1679 throw new RangeError.index(index, this, "index"); 1233 throw new RangeError.index(index, this, "index");
1680 } 1234 }
1681 return _getIndexedFloat64(index); 1235 return _getIndexedFloat64(index);
1682 } 1236 }
1683 1237
1684 void operator[]=(int index, double value) { 1238 void operator []=(int index, double value) {
1685 if (index < 0 || index >= length) { 1239 if (index < 0 || index >= length) {
1686 throw new RangeError.index(index, this, "index"); 1240 throw new RangeError.index(index, this, "index");
1687 } 1241 }
1688 _setIndexedFloat64(index, value); 1242 _setIndexedFloat64(index, value);
1689 } 1243 }
1690 1244
1691
1692 // Method(s) implementing the TypedData interface. 1245 // Method(s) implementing the TypedData interface.
1693 static const int BYTES_PER_ELEMENT = 8;
1694
1695 int get elementSizeInBytes { 1246 int get elementSizeInBytes {
1696 return Float64List.BYTES_PER_ELEMENT; 1247 return Float64List.BYTES_PER_ELEMENT;
1697 } 1248 }
1698 1249
1699
1700 // Internal utility methods. 1250 // Internal utility methods.
1701
1702 Float64List _createList(int length) { 1251 Float64List _createList(int length) {
1703 return new Float64List(length); 1252 return new Float64List(length);
1704 } 1253 }
1705 1254
1706 double _getIndexedFloat64(int index) { 1255 double _getIndexedFloat64(int index) {
1707 return _getFloat64(index * Float64List.BYTES_PER_ELEMENT); 1256 return _getFloat64(index * Float64List.BYTES_PER_ELEMENT);
1708 } 1257 }
1709 1258
1710 void _setIndexedFloat64(int index, double value) { 1259 void _setIndexedFloat64(int index, double value) {
1711 _setFloat64(index * Float64List.BYTES_PER_ELEMENT, value); 1260 _setFloat64(index * Float64List.BYTES_PER_ELEMENT, value);
1712 } 1261 }
1713 } 1262 }
1714 1263
1715 1264 @patch
1716 class Float32x4List extends _TypedList with _Float32x4ListMixin implements List< Float32x4>, TypedData { 1265 class Float32x4List {
1717 // Factory constructors. 1266 @patch
1718
1719 factory Float32x4List(int length) native "TypedData_Float32x4Array_new"; 1267 factory Float32x4List(int length) native "TypedData_Float32x4Array_new";
1720 1268
1269 @patch
1721 factory Float32x4List.fromList(List<Float32x4> elements) { 1270 factory Float32x4List.fromList(List<Float32x4> elements) {
1722 return new Float32x4List(elements.length) 1271 return new Float32x4List(elements.length)
1723 ..setRange(0, elements.length, elements); 1272 ..setRange(0, elements.length, elements);
1724 } 1273 }
1274 }
1725 1275
1726 factory Float32x4List.view(ByteBuffer buffer, 1276 class _Float32x4List extends _TypedList
1727 [int offsetInBytes = 0, int length]) { 1277 with _Float32x4ListMixin
1728 return buffer.asFloat32x4List(offsetInBytes, length); 1278 implements Float32x4List {
1729 } 1279 Type get runtimeType => Float32x4List;
1730 1280
1731 Float32x4 operator[](int index) { 1281 Float32x4 operator [](int index) {
1732 if (index < 0 || index >= length) { 1282 if (index < 0 || index >= length) {
1733 throw new RangeError.index(index, this, "index"); 1283 throw new RangeError.index(index, this, "index");
1734 } 1284 }
1735 return _getIndexedFloat32x4(index); 1285 return _getIndexedFloat32x4(index);
1736 } 1286 }
1737 1287
1738 void operator[]=(int index, Float32x4 value) { 1288 void operator []=(int index, Float32x4 value) {
1739 if (index < 0 || index >= length) { 1289 if (index < 0 || index >= length) {
1740 throw new RangeError.index(index, this, "index"); 1290 throw new RangeError.index(index, this, "index");
1741 } 1291 }
1742 _setIndexedFloat32x4(index, value); 1292 _setIndexedFloat32x4(index, value);
1743 } 1293 }
1744 1294
1745
1746 // Method(s) implementing the TypedData interface. 1295 // Method(s) implementing the TypedData interface.
1747 static const int BYTES_PER_ELEMENT = 16;
1748
1749 int get elementSizeInBytes { 1296 int get elementSizeInBytes {
1750 return Float32x4List.BYTES_PER_ELEMENT; 1297 return Float32x4List.BYTES_PER_ELEMENT;
1751 } 1298 }
1752 1299
1753
1754 // Internal utility methods. 1300 // Internal utility methods.
1755
1756 Float32x4List _createList(int length) { 1301 Float32x4List _createList(int length) {
1757 return new Float32x4List(length); 1302 return new Float32x4List(length);
1758 } 1303 }
1759 1304
1760 Float32x4 _getIndexedFloat32x4(int index) { 1305 Float32x4 _getIndexedFloat32x4(int index) {
1761 return _getFloat32x4(index * Float32x4List.BYTES_PER_ELEMENT); 1306 return _getFloat32x4(index * Float32x4List.BYTES_PER_ELEMENT);
1762 } 1307 }
1763 1308
1764 void _setIndexedFloat32x4(int index, Float32x4 value) { 1309 void _setIndexedFloat32x4(int index, Float32x4 value) {
1765 _setFloat32x4(index * Float32x4List.BYTES_PER_ELEMENT, value); 1310 _setFloat32x4(index * Float32x4List.BYTES_PER_ELEMENT, value);
1766 } 1311 }
1767 } 1312 }
1768 1313
1769 1314 @patch
1770 class Int32x4List extends _TypedList with _Int32x4ListMixin implements List<Int3 2x4>, TypedData { 1315 class Int32x4List {
1771 // Factory constructors. 1316 @patch
1772
1773 factory Int32x4List(int length) native "TypedData_Int32x4Array_new"; 1317 factory Int32x4List(int length) native "TypedData_Int32x4Array_new";
1774 1318
1319 @patch
1775 factory Int32x4List.fromList(List<Int32x4> elements) { 1320 factory Int32x4List.fromList(List<Int32x4> elements) {
1776 return new Int32x4List(elements.length) 1321 return new Int32x4List(elements.length)
1777 ..setRange(0, elements.length, elements); 1322 ..setRange(0, elements.length, elements);
1778 } 1323 }
1324 }
1779 1325
1780 factory Int32x4List.view(ByteBuffer buffer, 1326 class _Int32x4List extends _TypedList
1781 [int offsetInBytes = 0, int length]) { 1327 with _Int32x4ListMixin
1782 return buffer.asInt32x4List(offsetInBytes, length); 1328 implements Int32x4List {
1783 } 1329 Type get runtimeType => Int32x4List;
1784 1330
1785 Int32x4 operator[](int index) { 1331 Int32x4 operator [](int index) {
1786 if (index < 0 || index >= length) { 1332 if (index < 0 || index >= length) {
1787 throw new RangeError.index(index, this, "index"); 1333 throw new RangeError.index(index, this, "index");
1788 } 1334 }
1789 return _getIndexedInt32x4(index); 1335 return _getIndexedInt32x4(index);
1790 } 1336 }
1791 1337
1792 void operator[]=(int index, Int32x4 value) { 1338 void operator []=(int index, Int32x4 value) {
1793 if (index < 0 || index >= length) { 1339 if (index < 0 || index >= length) {
1794 throw new RangeError.index(index, this, "index"); 1340 throw new RangeError.index(index, this, "index");
1795 } 1341 }
1796 _setIndexedInt32x4(index, value); 1342 _setIndexedInt32x4(index, value);
1797 } 1343 }
1798 1344
1799
1800 // Method(s) implementing the TypedData interface. 1345 // Method(s) implementing the TypedData interface.
1801 static const int BYTES_PER_ELEMENT = 16;
1802
1803 int get elementSizeInBytes { 1346 int get elementSizeInBytes {
1804 return Int32x4List.BYTES_PER_ELEMENT; 1347 return Int32x4List.BYTES_PER_ELEMENT;
1805 } 1348 }
1806 1349
1807
1808 // Internal utility methods. 1350 // Internal utility methods.
1809
1810 Int32x4List _createList(int length) { 1351 Int32x4List _createList(int length) {
1811 return new Int32x4List(length); 1352 return new Int32x4List(length);
1812 } 1353 }
1813 1354
1814 Int32x4 _getIndexedInt32x4(int index) { 1355 Int32x4 _getIndexedInt32x4(int index) {
1815 return _getInt32x4(index * Int32x4List.BYTES_PER_ELEMENT); 1356 return _getInt32x4(index * Int32x4List.BYTES_PER_ELEMENT);
1816 } 1357 }
1817 1358
1818 void _setIndexedInt32x4(int index, Int32x4 value) { 1359 void _setIndexedInt32x4(int index, Int32x4 value) {
1819 _setInt32x4(index * Int32x4List.BYTES_PER_ELEMENT, value); 1360 _setInt32x4(index * Int32x4List.BYTES_PER_ELEMENT, value);
1820 } 1361 }
1821 } 1362 }
1822 1363
1823 1364 @patch
1824 class Float64x2List extends _TypedList with _Float64x2ListMixin implements List< Float64x2>, TypedData { 1365 class Float64x2List {
1825 // Factory constructors. 1366 @patch
1826
1827 factory Float64x2List(int length) native "TypedData_Float64x2Array_new"; 1367 factory Float64x2List(int length) native "TypedData_Float64x2Array_new";
1828 1368
1369 @patch
1829 factory Float64x2List.fromList(List<Float64x2> elements) { 1370 factory Float64x2List.fromList(List<Float64x2> elements) {
1830 return new Float64x2List(elements.length) 1371 return new Float64x2List(elements.length)
1831 ..setRange(0, elements.length, elements); 1372 ..setRange(0, elements.length, elements);
1832 } 1373 }
1374 }
1833 1375
1834 factory Float64x2List.view(ByteBuffer buffer, 1376 class _Float64x2List extends _TypedList
1835 [int offsetInBytes = 0, int length]) { 1377 with _Float64x2ListMixin
1836 return buffer.asFloat64x2List(offsetInBytes, length); 1378 implements Float64x2List {
1837 } 1379 Type get runtimeType => Float64x2List;
1838 1380
1839 Float64x2 operator[](int index) { 1381 Float64x2 operator [](int index) {
1840 if (index < 0 || index >= length) { 1382 if (index < 0 || index >= length) {
1841 throw new RangeError.index(index, this, "index"); 1383 throw new RangeError.index(index, this, "index");
1842 } 1384 }
1843 return _getIndexedFloat64x2(index); 1385 return _getIndexedFloat64x2(index);
1844 } 1386 }
1845 1387
1846 void operator[]=(int index, Float64x2 value) { 1388 void operator []=(int index, Float64x2 value) {
1847 if (index < 0 || index >= length) { 1389 if (index < 0 || index >= length) {
1848 throw new RangeError.index(index, this, "index"); 1390 throw new RangeError.index(index, this, "index");
1849 } 1391 }
1850 _setIndexedFloat64x2(index, value); 1392 _setIndexedFloat64x2(index, value);
1851 } 1393 }
1852 1394
1853
1854 // Method(s) implementing the TypedData interface. 1395 // Method(s) implementing the TypedData interface.
1855 static const int BYTES_PER_ELEMENT = 16;
1856
1857 int get elementSizeInBytes { 1396 int get elementSizeInBytes {
1858 return Float64x2List.BYTES_PER_ELEMENT; 1397 return Float64x2List.BYTES_PER_ELEMENT;
1859 } 1398 }
1860 1399
1861
1862 // Internal utility methods. 1400 // Internal utility methods.
1863
1864 Float64x2List _createList(int length) { 1401 Float64x2List _createList(int length) {
1865 return new Float64x2List(length); 1402 return new Float64x2List(length);
1866 } 1403 }
1867 1404
1868 Float64x2 _getIndexedFloat64x2(int index) { 1405 Float64x2 _getIndexedFloat64x2(int index) {
1869 return _getFloat64x2(index * Float64x2List.BYTES_PER_ELEMENT); 1406 return _getFloat64x2(index * Float64x2List.BYTES_PER_ELEMENT);
1870 } 1407 }
1871 1408
1872 void _setIndexedFloat64x2(int index, Float64x2 value) { 1409 void _setIndexedFloat64x2(int index, Float64x2 value) {
1873 _setFloat64x2(index * Float64x2List.BYTES_PER_ELEMENT, value); 1410 _setFloat64x2(index * Float64x2List.BYTES_PER_ELEMENT, value);
1874 } 1411 }
1875 } 1412 }
1876 1413
1877 1414 class _ExternalInt8Array extends _TypedList
1878 class _ExternalInt8Array extends _TypedList with _IntListMixin implements Int8Li st { 1415 with _IntListMixin
1416 implements Int8List {
1879 // Method(s) implementing the List interface. 1417 // Method(s) implementing the List interface.
1880 int operator[](int index) { 1418 int operator [](int index) {
1881 if (index < 0 || index >= length) { 1419 if (index < 0 || index >= length) {
1882 throw new RangeError.index(index, this, "index"); 1420 throw new RangeError.index(index, this, "index");
1883 } 1421 }
1884 return _getInt8(index); 1422 return _getInt8(index);
1885 } 1423 }
1886 1424
1887 void operator[]=(int index, int value) { 1425 void operator []=(int index, int value) {
1888 if (index < 0 || index >= length) { 1426 if (index < 0 || index >= length) {
1889 throw new RangeError.index(index, this, "index"); 1427 throw new RangeError.index(index, this, "index");
1890 } 1428 }
1891 _setInt8(index, value); 1429 _setInt8(index, value);
1892 } 1430 }
1893 1431
1894
1895 // Method(s) implementing the TypedData interface. 1432 // Method(s) implementing the TypedData interface.
1896
1897 int get elementSizeInBytes { 1433 int get elementSizeInBytes {
1898 return Int8List.BYTES_PER_ELEMENT; 1434 return Int8List.BYTES_PER_ELEMENT;
1899 } 1435 }
1900 1436
1901
1902 // Internal utility methods. 1437 // Internal utility methods.
1903
1904 Int8List _createList(int length) { 1438 Int8List _createList(int length) {
1905 return new Int8List(length); 1439 return new Int8List(length);
1906 } 1440 }
1907 } 1441 }
1908 1442
1909 1443 class _ExternalUint8Array extends _TypedList
1910 class _ExternalUint8Array extends _TypedList with _IntListMixin implements Uint8 List { 1444 with _IntListMixin
1445 implements Uint8List {
1911 // Method(s) implementing the List interface. 1446 // Method(s) implementing the List interface.
1912 1447 int operator [](int index) {
1913 int operator[](int index) {
1914 if (index < 0 || index >= length) { 1448 if (index < 0 || index >= length) {
1915 throw new RangeError.index(index, this, "index"); 1449 throw new RangeError.index(index, this, "index");
1916 } 1450 }
1917 return _getUint8(index); 1451 return _getUint8(index);
1918 } 1452 }
1919 1453
1920 void operator[]=(int index, int value) { 1454 void operator []=(int index, int value) {
1921 if (index < 0 || index >= length) { 1455 if (index < 0 || index >= length) {
1922 throw new RangeError.index(index, this, "index"); 1456 throw new RangeError.index(index, this, "index");
1923 } 1457 }
1924 _setUint8(index, _toUint8(value)); 1458 _setUint8(index, _toUint8(value));
1925 } 1459 }
1926 1460
1927
1928 // Method(s) implementing the TypedData interface. 1461 // Method(s) implementing the TypedData interface.
1929
1930 int get elementSizeInBytes { 1462 int get elementSizeInBytes {
1931 return Uint8List.BYTES_PER_ELEMENT; 1463 return Uint8List.BYTES_PER_ELEMENT;
1932 } 1464 }
1933 1465
1934
1935 // Internal utility methods. 1466 // Internal utility methods.
1936
1937 Uint8List _createList(int length) { 1467 Uint8List _createList(int length) {
1938 return new Uint8List(length); 1468 return new Uint8List(length);
1939 } 1469 }
1940 } 1470 }
1941 1471
1942 1472 class _ExternalUint8ClampedArray extends _TypedList
1943 class _ExternalUint8ClampedArray extends _TypedList with _IntListMixin implement s Uint8ClampedList { 1473 with _IntListMixin
1474 implements Uint8ClampedList {
1944 // Method(s) implementing the List interface. 1475 // Method(s) implementing the List interface.
1945 1476 int operator [](int index) {
1946 int operator[](int index) {
1947 if (index < 0 || index >= length) { 1477 if (index < 0 || index >= length) {
1948 throw new RangeError.index(index, this, "index"); 1478 throw new RangeError.index(index, this, "index");
1949 } 1479 }
1950 return _getUint8(index); 1480 return _getUint8(index);
1951 } 1481 }
1952 1482
1953 void operator[]=(int index, int value) { 1483 void operator []=(int index, int value) {
1954 if (index < 0 || index >= length) { 1484 if (index < 0 || index >= length) {
1955 throw new RangeError.index(index, this, "index"); 1485 throw new RangeError.index(index, this, "index");
1956 } 1486 }
1957 _setUint8(index, _toClampedUint8(value)); 1487 _setUint8(index, _toClampedUint8(value));
1958 } 1488 }
1959 1489
1960
1961 // Method(s) implementing the TypedData interface. 1490 // Method(s) implementing the TypedData interface.
1962
1963 int get elementSizeInBytes { 1491 int get elementSizeInBytes {
1964 return Uint8List.BYTES_PER_ELEMENT; 1492 return Uint8List.BYTES_PER_ELEMENT;
1965 } 1493 }
1966 1494
1967
1968 // Internal utility methods. 1495 // Internal utility methods.
1969
1970 Uint8ClampedList _createList(int length) { 1496 Uint8ClampedList _createList(int length) {
1971 return new Uint8ClampedList(length); 1497 return new Uint8ClampedList(length);
1972 } 1498 }
1973 } 1499 }
1974 1500
1975 1501 class _ExternalInt16Array extends _TypedList
1976 class _ExternalInt16Array extends _TypedList with _IntListMixin implements Int16 List { 1502 with _IntListMixin
1503 implements Int16List {
1977 // Method(s) implementing the List interface. 1504 // Method(s) implementing the List interface.
1978 1505
1979 int operator[](int index) { 1506 int operator [](int index) {
1980 if (index < 0 || index >= length) { 1507 if (index < 0 || index >= length) {
1981 throw new RangeError.index(index, this, "index"); 1508 throw new RangeError.index(index, this, "index");
1982 } 1509 }
1983 return _getIndexedInt16(index); 1510 return _getIndexedInt16(index);
1984 } 1511 }
1985 1512
1986 void operator[]=(int index, int value) { 1513 void operator []=(int index, int value) {
1987 if (index < 0 || index >= length) { 1514 if (index < 0 || index >= length) {
1988 throw new RangeError.index(index, this, "index"); 1515 throw new RangeError.index(index, this, "index");
1989 } 1516 }
1990 _setIndexedInt16(index, _toInt16(value)); 1517 _setIndexedInt16(index, _toInt16(value));
1991 } 1518 }
1992 1519
1993
1994 // Method(s) implementing the TypedData interface. 1520 // Method(s) implementing the TypedData interface.
1995
1996 int get elementSizeInBytes { 1521 int get elementSizeInBytes {
1997 return Int16List.BYTES_PER_ELEMENT; 1522 return Int16List.BYTES_PER_ELEMENT;
1998 } 1523 }
1999 1524
2000
2001 // Internal utility methods. 1525 // Internal utility methods.
2002
2003 Int16List _createList(int length) { 1526 Int16List _createList(int length) {
2004 return new Int16List(length); 1527 return new Int16List(length);
2005 } 1528 }
2006 1529
2007 int _getIndexedInt16(int index) { 1530 int _getIndexedInt16(int index) {
2008 return _getInt16(index * Int16List.BYTES_PER_ELEMENT); 1531 return _getInt16(index * Int16List.BYTES_PER_ELEMENT);
2009 } 1532 }
2010 1533
2011 void _setIndexedInt16(int index, int value) { 1534 void _setIndexedInt16(int index, int value) {
2012 _setInt16(index * Int16List.BYTES_PER_ELEMENT, value); 1535 _setInt16(index * Int16List.BYTES_PER_ELEMENT, value);
2013 } 1536 }
2014 } 1537 }
2015 1538
2016 1539 class _ExternalUint16Array extends _TypedList
2017 class _ExternalUint16Array extends _TypedList with _IntListMixin implements Uint 16List { 1540 with _IntListMixin
1541 implements Uint16List {
2018 // Method(s) implementing the List interface. 1542 // Method(s) implementing the List interface.
2019 1543
2020 int operator[](int index) { 1544 int operator [](int index) {
2021 if (index < 0 || index >= length) { 1545 if (index < 0 || index >= length) {
2022 throw new RangeError.index(index, this, "index"); 1546 throw new RangeError.index(index, this, "index");
2023 } 1547 }
2024 return _getIndexedUint16(index); 1548 return _getIndexedUint16(index);
2025 } 1549 }
2026 1550
2027 void operator[]=(int index, int value) { 1551 void operator []=(int index, int value) {
2028 if (index < 0 || index >= length) { 1552 if (index < 0 || index >= length) {
2029 throw new RangeError.index(index, this, "index"); 1553 throw new RangeError.index(index, this, "index");
2030 } 1554 }
2031 _setIndexedUint16(index, _toUint16(value)); 1555 _setIndexedUint16(index, _toUint16(value));
2032 } 1556 }
2033 1557
2034
2035 // Method(s) implementing the TypedData interface. 1558 // Method(s) implementing the TypedData interface.
2036
2037 int get elementSizeInBytes { 1559 int get elementSizeInBytes {
2038 return Uint16List.BYTES_PER_ELEMENT; 1560 return Uint16List.BYTES_PER_ELEMENT;
2039 } 1561 }
2040 1562
2041
2042 // Internal utility methods. 1563 // Internal utility methods.
2043
2044 Uint16List _createList(int length) { 1564 Uint16List _createList(int length) {
2045 return new Uint16List(length); 1565 return new Uint16List(length);
2046 } 1566 }
2047 1567
2048 int _getIndexedUint16(int index) { 1568 int _getIndexedUint16(int index) {
2049 return _getUint16(index * Uint16List.BYTES_PER_ELEMENT); 1569 return _getUint16(index * Uint16List.BYTES_PER_ELEMENT);
2050 } 1570 }
2051 1571
2052 void _setIndexedUint16(int index, int value) { 1572 void _setIndexedUint16(int index, int value) {
2053 _setUint16(index * Uint16List.BYTES_PER_ELEMENT, value); 1573 _setUint16(index * Uint16List.BYTES_PER_ELEMENT, value);
2054 } 1574 }
2055 } 1575 }
2056 1576
2057 1577 class _ExternalInt32Array extends _TypedList
2058 class _ExternalInt32Array extends _TypedList with _IntListMixin implements Int32 List { 1578 with _IntListMixin
1579 implements Int32List {
2059 // Method(s) implementing the List interface. 1580 // Method(s) implementing the List interface.
2060 1581 int operator [](int index) {
2061 int operator[](int index) {
2062 if (index < 0 || index >= length) { 1582 if (index < 0 || index >= length) {
2063 throw new RangeError.index(index, this, "index"); 1583 throw new RangeError.index(index, this, "index");
2064 } 1584 }
2065 return _getIndexedInt32(index); 1585 return _getIndexedInt32(index);
2066 } 1586 }
2067 1587
2068 void operator[]=(int index, int value) { 1588 void operator []=(int index, int value) {
2069 if (index < 0 || index >= length) { 1589 if (index < 0 || index >= length) {
2070 throw new RangeError.index(index, this, "index"); 1590 throw new RangeError.index(index, this, "index");
2071 } 1591 }
2072 _setIndexedInt32(index, _toInt32(value)); 1592 _setIndexedInt32(index, _toInt32(value));
2073 } 1593 }
2074 1594
2075
2076 // Method(s) implementing the TypedData interface. 1595 // Method(s) implementing the TypedData interface.
2077
2078 int get elementSizeInBytes { 1596 int get elementSizeInBytes {
2079 return Int32List.BYTES_PER_ELEMENT; 1597 return Int32List.BYTES_PER_ELEMENT;
2080 } 1598 }
2081 1599
2082
2083 // Internal utility methods. 1600 // Internal utility methods.
2084
2085 Int32List _createList(int length) { 1601 Int32List _createList(int length) {
2086 return new Int32List(length); 1602 return new Int32List(length);
2087 } 1603 }
2088 1604
2089 int _getIndexedInt32(int index) { 1605 int _getIndexedInt32(int index) {
2090 return _getInt32(index * Int32List.BYTES_PER_ELEMENT); 1606 return _getInt32(index * Int32List.BYTES_PER_ELEMENT);
2091 } 1607 }
2092 1608
2093 void _setIndexedInt32(int index, int value) { 1609 void _setIndexedInt32(int index, int value) {
2094 _setInt32(index * Int32List.BYTES_PER_ELEMENT, value); 1610 _setInt32(index * Int32List.BYTES_PER_ELEMENT, value);
2095 } 1611 }
2096 } 1612 }
2097 1613
2098 1614 class _ExternalUint32Array extends _TypedList
2099 class _ExternalUint32Array extends _TypedList with _IntListMixin implements Uint 32List { 1615 with _IntListMixin
1616 implements Uint32List {
2100 // Method(s) implementing the List interface. 1617 // Method(s) implementing the List interface.
2101 1618
2102 int operator[](int index) { 1619 int operator [](int index) {
2103 if (index < 0 || index >= length) { 1620 if (index < 0 || index >= length) {
2104 throw new RangeError.index(index, this, "index"); 1621 throw new RangeError.index(index, this, "index");
2105 } 1622 }
2106 return _getIndexedUint32(index); 1623 return _getIndexedUint32(index);
2107 } 1624 }
2108 1625
2109 void operator[]=(int index, int value) { 1626 void operator []=(int index, int value) {
2110 if (index < 0 || index >= length) { 1627 if (index < 0 || index >= length) {
2111 throw new RangeError.index(index, this, "index"); 1628 throw new RangeError.index(index, this, "index");
2112 } 1629 }
2113 _setIndexedUint32(index, _toUint32(value)); 1630 _setIndexedUint32(index, _toUint32(value));
2114 } 1631 }
2115 1632
2116
2117 // Method(s) implementing the TypedData interface. 1633 // Method(s) implementing the TypedData interface.
2118
2119 int get elementSizeInBytes { 1634 int get elementSizeInBytes {
2120 return Uint32List.BYTES_PER_ELEMENT; 1635 return Uint32List.BYTES_PER_ELEMENT;
2121 } 1636 }
2122 1637
2123
2124 // Internal utility methods. 1638 // Internal utility methods.
2125
2126 Uint32List _createList(int length) { 1639 Uint32List _createList(int length) {
2127 return new Uint32List(length); 1640 return new Uint32List(length);
2128 } 1641 }
2129 1642
2130 int _getIndexedUint32(int index) { 1643 int _getIndexedUint32(int index) {
2131 return _getUint32(index * Uint32List.BYTES_PER_ELEMENT); 1644 return _getUint32(index * Uint32List.BYTES_PER_ELEMENT);
2132 } 1645 }
2133 1646
2134 void _setIndexedUint32(int index, int value) { 1647 void _setIndexedUint32(int index, int value) {
2135 _setUint32(index * Uint32List.BYTES_PER_ELEMENT, value); 1648 _setUint32(index * Uint32List.BYTES_PER_ELEMENT, value);
2136 } 1649 }
2137 } 1650 }
2138 1651
2139 1652 class _ExternalInt64Array extends _TypedList
2140 class _ExternalInt64Array extends _TypedList with _IntListMixin implements Int64 List { 1653 with _IntListMixin
1654 implements Int64List {
2141 // Method(s) implementing the List interface. 1655 // Method(s) implementing the List interface.
2142 1656
2143 int operator[](int index) { 1657 int operator [](int index) {
2144 if (index < 0 || index >= length) { 1658 if (index < 0 || index >= length) {
2145 throw new RangeError.index(index, this, "index"); 1659 throw new RangeError.index(index, this, "index");
2146 } 1660 }
2147 return _getIndexedInt64(index); 1661 return _getIndexedInt64(index);
2148 } 1662 }
2149 1663
2150 void operator[]=(int index, int value) { 1664 void operator []=(int index, int value) {
2151 if (index < 0 || index >= length) { 1665 if (index < 0 || index >= length) {
2152 throw new RangeError.index(index, this, "index"); 1666 throw new RangeError.index(index, this, "index");
2153 } 1667 }
2154 _setIndexedInt64(index, _toInt64(value)); 1668 _setIndexedInt64(index, _toInt64(value));
2155 } 1669 }
2156 1670
2157
2158 // Method(s) implementing the TypedData interface. 1671 // Method(s) implementing the TypedData interface.
2159
2160 int get elementSizeInBytes { 1672 int get elementSizeInBytes {
2161 return Int64List.BYTES_PER_ELEMENT; 1673 return Int64List.BYTES_PER_ELEMENT;
2162 } 1674 }
2163 1675
2164
2165 // Internal utility methods. 1676 // Internal utility methods.
2166
2167 Int64List _createList(int length) { 1677 Int64List _createList(int length) {
2168 return new Int64List(length); 1678 return new Int64List(length);
2169 } 1679 }
2170 1680
2171 int _getIndexedInt64(int index) { 1681 int _getIndexedInt64(int index) {
2172 return _getInt64(index * Int64List.BYTES_PER_ELEMENT); 1682 return _getInt64(index * Int64List.BYTES_PER_ELEMENT);
2173 } 1683 }
2174 1684
2175 void _setIndexedInt64(int index, int value) { 1685 void _setIndexedInt64(int index, int value) {
2176 _setInt64(index * Int64List.BYTES_PER_ELEMENT, value); 1686 _setInt64(index * Int64List.BYTES_PER_ELEMENT, value);
2177 } 1687 }
2178 } 1688 }
2179 1689
2180 1690 class _ExternalUint64Array extends _TypedList
2181 class _ExternalUint64Array extends _TypedList with _IntListMixin implements Uint 64List { 1691 with _IntListMixin
1692 implements Uint64List {
2182 // Method(s) implementing the List interface. 1693 // Method(s) implementing the List interface.
2183 1694
2184 int operator[](int index) { 1695 int operator [](int index) {
2185 if (index < 0 || index >= length) { 1696 if (index < 0 || index >= length) {
2186 throw new RangeError.index(index, this, "index"); 1697 throw new RangeError.index(index, this, "index");
2187 } 1698 }
2188 return _getIndexedUint64(index); 1699 return _getIndexedUint64(index);
2189 } 1700 }
2190 1701
2191 void operator[]=(int index, int value) { 1702 void operator []=(int index, int value) {
2192 if (index < 0 || index >= length) { 1703 if (index < 0 || index >= length) {
2193 throw new RangeError.index(index, this, "index"); 1704 throw new RangeError.index(index, this, "index");
2194 } 1705 }
2195 _setIndexedUint64(index, _toUint64(value)); 1706 _setIndexedUint64(index, _toUint64(value));
2196 } 1707 }
2197 1708
2198
2199 // Method(s) implementing the TypedData interface. 1709 // Method(s) implementing the TypedData interface.
2200
2201 int get elementSizeInBytes { 1710 int get elementSizeInBytes {
2202 return Uint64List.BYTES_PER_ELEMENT; 1711 return Uint64List.BYTES_PER_ELEMENT;
2203 } 1712 }
2204 1713
2205
2206 // Internal utility methods. 1714 // Internal utility methods.
2207
2208 Uint64List _createList(int length) { 1715 Uint64List _createList(int length) {
2209 return new Uint64List(length); 1716 return new Uint64List(length);
2210 } 1717 }
2211 1718
2212 int _getIndexedUint64(int index) { 1719 int _getIndexedUint64(int index) {
2213 return _getUint64(index * Uint64List.BYTES_PER_ELEMENT); 1720 return _getUint64(index * Uint64List.BYTES_PER_ELEMENT);
2214 } 1721 }
2215 1722
2216 void _setIndexedUint64(int index, int value) { 1723 void _setIndexedUint64(int index, int value) {
2217 _setUint64(index * Uint64List.BYTES_PER_ELEMENT, value); 1724 _setUint64(index * Uint64List.BYTES_PER_ELEMENT, value);
2218 } 1725 }
2219 } 1726 }
2220 1727
2221 1728 class _ExternalFloat32Array extends _TypedList
2222 class _ExternalFloat32Array extends _TypedList with _DoubleListMixin implements Float32List { 1729 with _DoubleListMixin
1730 implements Float32List {
2223 // Method(s) implementing the List interface. 1731 // Method(s) implementing the List interface.
2224 1732
2225 double operator[](int index) { 1733 double operator [](int index) {
2226 if (index < 0 || index >= length) { 1734 if (index < 0 || index >= length) {
2227 throw new RangeError.index(index, this, "index"); 1735 throw new RangeError.index(index, this, "index");
2228 } 1736 }
2229 return _getIndexedFloat32(index); 1737 return _getIndexedFloat32(index);
2230 } 1738 }
2231 1739
2232 void operator[]=(int index, double value) { 1740 void operator []=(int index, double value) {
2233 if (index < 0 || index >= length) { 1741 if (index < 0 || index >= length) {
2234 throw new RangeError.index(index, this, "index"); 1742 throw new RangeError.index(index, this, "index");
2235 } 1743 }
2236 _setIndexedFloat32(index, value); 1744 _setIndexedFloat32(index, value);
2237 } 1745 }
2238 1746
2239
2240 // Method(s) implementing the TypedData interface. 1747 // Method(s) implementing the TypedData interface.
2241
2242 int get elementSizeInBytes { 1748 int get elementSizeInBytes {
2243 return Float32List.BYTES_PER_ELEMENT; 1749 return Float32List.BYTES_PER_ELEMENT;
2244 } 1750 }
2245 1751
2246
2247 // Internal utility methods. 1752 // Internal utility methods.
2248
2249 Float32List _createList(int length) { 1753 Float32List _createList(int length) {
2250 return new Float32List(length); 1754 return new Float32List(length);
2251 } 1755 }
2252 1756
2253 double _getIndexedFloat32(int index) { 1757 double _getIndexedFloat32(int index) {
2254 return _getFloat32(index * Float32List.BYTES_PER_ELEMENT); 1758 return _getFloat32(index * Float32List.BYTES_PER_ELEMENT);
2255 } 1759 }
2256 1760
2257 void _setIndexedFloat32(int index, double value) { 1761 void _setIndexedFloat32(int index, double value) {
2258 _setFloat32(index * Float32List.BYTES_PER_ELEMENT, value); 1762 _setFloat32(index * Float32List.BYTES_PER_ELEMENT, value);
2259 } 1763 }
2260 } 1764 }
2261 1765
2262 1766 class _ExternalFloat64Array extends _TypedList
2263 class _ExternalFloat64Array extends _TypedList with _DoubleListMixin implements Float64List { 1767 with _DoubleListMixin
1768 implements Float64List {
2264 // Method(s) implementing the List interface. 1769 // Method(s) implementing the List interface.
2265 1770
2266 double operator[](int index) { 1771 double operator [](int index) {
2267 if (index < 0 || index >= length) { 1772 if (index < 0 || index >= length) {
2268 throw new RangeError.index(index, this, "index"); 1773 throw new RangeError.index(index, this, "index");
2269 } 1774 }
2270 return _getIndexedFloat64(index); 1775 return _getIndexedFloat64(index);
2271 } 1776 }
2272 1777
2273 void operator[]=(int index, double value) { 1778 void operator []=(int index, double value) {
2274 if (index < 0 || index >= length) { 1779 if (index < 0 || index >= length) {
2275 throw new RangeError.index(index, this, "index"); 1780 throw new RangeError.index(index, this, "index");
2276 } 1781 }
2277 _setIndexedFloat64(index, value); 1782 _setIndexedFloat64(index, value);
2278 } 1783 }
2279 1784
2280
2281 // Method(s) implementing the TypedData interface. 1785 // Method(s) implementing the TypedData interface.
2282
2283 int get elementSizeInBytes { 1786 int get elementSizeInBytes {
2284 return Float64List.BYTES_PER_ELEMENT; 1787 return Float64List.BYTES_PER_ELEMENT;
2285 } 1788 }
2286 1789
2287
2288 // Internal utility methods. 1790 // Internal utility methods.
2289
2290 Float64List _createList(int length) { 1791 Float64List _createList(int length) {
2291 return new Float64List(length); 1792 return new Float64List(length);
2292 } 1793 }
2293 1794
2294 double _getIndexedFloat64(int index) { 1795 double _getIndexedFloat64(int index) {
2295 return _getFloat64(index * Float64List.BYTES_PER_ELEMENT); 1796 return _getFloat64(index * Float64List.BYTES_PER_ELEMENT);
2296 } 1797 }
2297 1798
2298 void _setIndexedFloat64(int index, double value) { 1799 void _setIndexedFloat64(int index, double value) {
2299 _setFloat64(index * Float64List.BYTES_PER_ELEMENT, value); 1800 _setFloat64(index * Float64List.BYTES_PER_ELEMENT, value);
2300 } 1801 }
2301 } 1802 }
2302 1803
2303 1804 class _ExternalFloat32x4Array extends _TypedList
2304 class _ExternalFloat32x4Array extends _TypedList with _Float32x4ListMixin implem ents Float32x4List { 1805 with _Float32x4ListMixin
1806 implements Float32x4List {
2305 // Method(s) implementing the List interface. 1807 // Method(s) implementing the List interface.
2306 1808
2307 Float32x4 operator[](int index) { 1809 Float32x4 operator [](int index) {
2308 if (index < 0 || index >= length) { 1810 if (index < 0 || index >= length) {
2309 throw new RangeError.index(index, this, "index"); 1811 throw new RangeError.index(index, this, "index");
2310 } 1812 }
2311 return _getIndexedFloat32x4(index); 1813 return _getIndexedFloat32x4(index);
2312 } 1814 }
2313 1815
2314 void operator[]=(int index, Float32x4 value) { 1816 void operator []=(int index, Float32x4 value) {
2315 if (index < 0 || index >= length) { 1817 if (index < 0 || index >= length) {
2316 throw new RangeError.index(index, this, "index"); 1818 throw new RangeError.index(index, this, "index");
2317 } 1819 }
2318 _setIndexedFloat32x4(index, value); 1820 _setIndexedFloat32x4(index, value);
2319 } 1821 }
2320 1822
2321
2322 // Method(s) implementing the TypedData interface. 1823 // Method(s) implementing the TypedData interface.
2323
2324 int get elementSizeInBytes { 1824 int get elementSizeInBytes {
2325 return Float32x4List.BYTES_PER_ELEMENT; 1825 return Float32x4List.BYTES_PER_ELEMENT;
2326 } 1826 }
2327 1827
2328
2329 // Internal utility methods. 1828 // Internal utility methods.
2330
2331 Float32x4List _createList(int length) { 1829 Float32x4List _createList(int length) {
2332 return new Float32x4List(length); 1830 return new Float32x4List(length);
2333 } 1831 }
2334 1832
2335 Float32x4 _getIndexedFloat32x4(int index) { 1833 Float32x4 _getIndexedFloat32x4(int index) {
2336 return _getFloat32x4(index * Float32x4List.BYTES_PER_ELEMENT); 1834 return _getFloat32x4(index * Float32x4List.BYTES_PER_ELEMENT);
2337 } 1835 }
2338 1836
2339 void _setIndexedFloat32x4(int index, Float32x4 value) { 1837 void _setIndexedFloat32x4(int index, Float32x4 value) {
2340 _setFloat32x4(index * Float32x4List.BYTES_PER_ELEMENT, value); 1838 _setFloat32x4(index * Float32x4List.BYTES_PER_ELEMENT, value);
2341 } 1839 }
2342 } 1840 }
2343 1841
2344 1842 class _ExternalInt32x4Array extends _TypedList
2345 class _ExternalInt32x4Array extends _TypedList with _Int32x4ListMixin implements Int32x4List { 1843 with _Int32x4ListMixin
1844 implements Int32x4List {
2346 // Method(s) implementing the List interface. 1845 // Method(s) implementing the List interface.
2347 1846
2348 Int32x4 operator[](int index) { 1847 Int32x4 operator [](int index) {
2349 if (index < 0 || index >= length) { 1848 if (index < 0 || index >= length) {
2350 throw new RangeError.index(index, this, "index"); 1849 throw new RangeError.index(index, this, "index");
2351 } 1850 }
2352 return _getIndexedInt32x4(index); 1851 return _getIndexedInt32x4(index);
2353 } 1852 }
2354 1853
2355 void operator[]=(int index, Int32x4 value) { 1854 void operator []=(int index, Int32x4 value) {
2356 if (index < 0 || index >= length) { 1855 if (index < 0 || index >= length) {
2357 throw new RangeError.index(index, this, "index"); 1856 throw new RangeError.index(index, this, "index");
2358 } 1857 }
2359 _setIndexedInt32x4(index, value); 1858 _setIndexedInt32x4(index, value);
2360 } 1859 }
2361 1860
2362
2363 // Method(s) implementing the TypedData interface. 1861 // Method(s) implementing the TypedData interface.
2364
2365 int get elementSizeInBytes { 1862 int get elementSizeInBytes {
2366 return Int32x4List.BYTES_PER_ELEMENT; 1863 return Int32x4List.BYTES_PER_ELEMENT;
2367 } 1864 }
2368 1865
2369
2370 // Internal utility methods. 1866 // Internal utility methods.
2371
2372 Int32x4List _createList(int length) { 1867 Int32x4List _createList(int length) {
2373 return new Int32x4List(length); 1868 return new Int32x4List(length);
2374 } 1869 }
2375 1870
2376 Int32x4 _getIndexedInt32x4(int index) { 1871 Int32x4 _getIndexedInt32x4(int index) {
2377 return _getInt32x4(index * Int32x4List.BYTES_PER_ELEMENT); 1872 return _getInt32x4(index * Int32x4List.BYTES_PER_ELEMENT);
2378 } 1873 }
2379 1874
2380 void _setIndexedInt32x4(int index, Int32x4 value) { 1875 void _setIndexedInt32x4(int index, Int32x4 value) {
2381 _setInt32x4(index * Int32x4List.BYTES_PER_ELEMENT, value); 1876 _setInt32x4(index * Int32x4List.BYTES_PER_ELEMENT, value);
2382 } 1877 }
2383 } 1878 }
2384 1879
2385 1880 class _ExternalFloat64x2Array extends _TypedList
2386 class _ExternalFloat64x2Array extends _TypedList with _Float64x2ListMixin implem ents Float64x2List { 1881 with _Float64x2ListMixin
1882 implements Float64x2List {
2387 // Method(s) implementing the List interface. 1883 // Method(s) implementing the List interface.
2388 1884 Float64x2 operator [](int index) {
2389 Float64x2 operator[](int index) {
2390 if (index < 0 || index >= length) { 1885 if (index < 0 || index >= length) {
2391 throw new RangeError.index(index, this, "index"); 1886 throw new RangeError.index(index, this, "index");
2392 } 1887 }
2393 return _getIndexedFloat64x2(index); 1888 return _getIndexedFloat64x2(index);
2394 } 1889 }
2395 1890
2396 void operator[]=(int index, Float64x2 value) { 1891 void operator []=(int index, Float64x2 value) {
2397 if (index < 0 || index >= length) { 1892 if (index < 0 || index >= length) {
2398 throw new RangeError.index(index, this, "index"); 1893 throw new RangeError.index(index, this, "index");
2399 } 1894 }
2400 _setIndexedFloat64x2(index, value); 1895 _setIndexedFloat64x2(index, value);
2401 } 1896 }
2402 1897
2403
2404 // Method(s) implementing the TypedData interface. 1898 // Method(s) implementing the TypedData interface.
2405
2406 int get elementSizeInBytes { 1899 int get elementSizeInBytes {
2407 return Float64x2List.BYTES_PER_ELEMENT; 1900 return Float64x2List.BYTES_PER_ELEMENT;
2408 } 1901 }
2409 1902
2410
2411 // Internal utility methods. 1903 // Internal utility methods.
2412
2413 Float64x2List _createList(int length) { 1904 Float64x2List _createList(int length) {
2414 return new Float64x2List(length); 1905 return new Float64x2List(length);
2415 } 1906 }
2416 1907
2417 Float64x2 _getIndexedFloat64x2(int index) { 1908 Float64x2 _getIndexedFloat64x2(int index) {
2418 return _getFloat64x2(index * Float64x2List.BYTES_PER_ELEMENT); 1909 return _getFloat64x2(index * Float64x2List.BYTES_PER_ELEMENT);
2419 } 1910 }
2420 1911
2421 void _setIndexedFloat64x2(int index, Float64x2 value) { 1912 void _setIndexedFloat64x2(int index, Float64x2 value) {
2422 _setFloat64x2(index * Float64x2List.BYTES_PER_ELEMENT, value); 1913 _setFloat64x2(index * Float64x2List.BYTES_PER_ELEMENT, value);
2423 } 1914 }
2424 } 1915 }
2425 1916
2426 1917 @patch
2427 class Float32x4 { 1918 class Float32x4 {
1919 @patch
2428 factory Float32x4(double x, double y, double z, double w) 1920 factory Float32x4(double x, double y, double z, double w)
2429 native "Float32x4_fromDoubles"; 1921 native "Float32x4_fromDoubles";
1922
1923 @patch
2430 factory Float32x4.splat(double v) native "Float32x4_splat"; 1924 factory Float32x4.splat(double v) native "Float32x4_splat";
1925
1926 @patch
2431 factory Float32x4.zero() native "Float32x4_zero"; 1927 factory Float32x4.zero() native "Float32x4_zero";
1928
1929 @patch
2432 factory Float32x4.fromInt32x4Bits(Int32x4 x) 1930 factory Float32x4.fromInt32x4Bits(Int32x4 x)
2433 native "Float32x4_fromInt32x4Bits"; 1931 native "Float32x4_fromInt32x4Bits";
2434 factory Float32x4.fromFloat64x2(Float64x2 v) 1932
2435 native "Float32x4_fromFloat64x2"; 1933 @patch
2436 Float32x4 operator +(Float32x4 other) { 1934 factory Float32x4.fromFloat64x2(Float64x2 v) native "Float32x4_fromFloat64x2";
2437 return _add(other); 1935 }
2438 } 1936
2439 Float32x4 _add(Float32x4 other) native "Float32x4_add"; 1937 class _Float32x4 implements Float32x4 {
2440 Float32x4 operator -() { 1938 Float32x4 operator +(Float32x4 other) native "Float32x4_add";
2441 return _negate(); 1939 Float32x4 operator -() native "Float32x4_negate";
2442 } 1940 Float32x4 operator -(Float32x4 other) native "Float32x4_sub";
2443 Float32x4 _negate() native "Float32x4_negate"; 1941 Float32x4 operator *(Float32x4 other) native "Float32x4_mul";
2444 Float32x4 operator -(Float32x4 other) { 1942 Float32x4 operator /(Float32x4 other) native "Float32x4_div";
2445 return _sub(other); 1943 Int32x4 lessThan(Float32x4 other) native "Float32x4_cmplt";
2446 } 1944 Int32x4 lessThanOrEqual(Float32x4 other) native "Float32x4_cmplte";
2447 Float32x4 _sub(Float32x4 other) native "Float32x4_sub"; 1945 Int32x4 greaterThan(Float32x4 other) native "Float32x4_cmpgt";
2448 Float32x4 operator *(Float32x4 other) { 1946 Int32x4 greaterThanOrEqual(Float32x4 other) native "Float32x4_cmpgte";
2449 return _mul(other); 1947 Int32x4 equal(Float32x4 other) native "Float32x4_cmpequal";
2450 } 1948 Int32x4 notEqual(Float32x4 other) native "Float32x4_cmpnequal";
2451 Float32x4 _mul(Float32x4 other) native "Float32x4_mul"; 1949 Float32x4 scale(double s) native "Float32x4_scale";
2452 Float32x4 operator /(Float32x4 other) { 1950 Float32x4 abs() native "Float32x4_abs";
2453 return _div(other); 1951 Float32x4 clamp(Float32x4 lowerLimit, Float32x4 upperLimit)
2454 }
2455 Float32x4 _div(Float32x4 other) native "Float32x4_div";
2456 Int32x4 lessThan(Float32x4 other) {
2457 return _cmplt(other);
2458 }
2459 Int32x4 _cmplt(Float32x4 other) native "Float32x4_cmplt";
2460 Int32x4 lessThanOrEqual(Float32x4 other) {
2461 return _cmplte(other);
2462 }
2463 Int32x4 _cmplte(Float32x4 other) native "Float32x4_cmplte";
2464 Int32x4 greaterThan(Float32x4 other) {
2465 return _cmpgt(other);
2466 }
2467 Int32x4 _cmpgt(Float32x4 other) native "Float32x4_cmpgt";
2468 Int32x4 greaterThanOrEqual(Float32x4 other) {
2469 return _cmpgte(other);
2470 }
2471 Int32x4 _cmpgte(Float32x4 other) native "Float32x4_cmpgte";
2472 Int32x4 equal(Float32x4 other) {
2473 return _cmpequal(other);
2474 }
2475 Int32x4 _cmpequal(Float32x4 other)
2476 native "Float32x4_cmpequal";
2477 Int32x4 notEqual(Float32x4 other) {
2478 return _cmpnequal(other);
2479 }
2480 Int32x4 _cmpnequal(Float32x4 other)
2481 native "Float32x4_cmpnequal";
2482 Float32x4 scale(double s) {
2483 return _scale(s);
2484 }
2485 Float32x4 _scale(double s) native "Float32x4_scale";
2486 Float32x4 abs() {
2487 return _abs();
2488 }
2489 Float32x4 _abs() native "Float32x4_abs";
2490 Float32x4 clamp(Float32x4 lowerLimit, Float32x4 upperLimit) {
2491 return _clamp(lowerLimit, upperLimit);
2492 }
2493 Float32x4 _clamp(Float32x4 lowerLimit, Float32x4 upperLimit)
2494 native "Float32x4_clamp"; 1952 native "Float32x4_clamp";
2495 double get x native "Float32x4_getX"; 1953 double get x native "Float32x4_getX";
2496 double get y native "Float32x4_getY"; 1954 double get y native "Float32x4_getY";
2497 double get z native "Float32x4_getZ"; 1955 double get z native "Float32x4_getZ";
2498 double get w native "Float32x4_getW"; 1956 double get w native "Float32x4_getW";
2499 int get signMask native "Float32x4_getSignMask"; 1957 int get signMask native "Float32x4_getSignMask";
2500 1958
2501 Float32x4 shuffle(int mask) native "Float32x4_shuffle"; 1959 Float32x4 shuffle(int mask) native "Float32x4_shuffle";
2502 Float32x4 shuffleMix(Float32x4 zw, int mask) native "Float32x4_shuffleMix"; 1960 Float32x4 shuffleMix(Float32x4 zw, int mask) native "Float32x4_shuffleMix";
2503 1961
2504 Float32x4 withX(double x) native "Float32x4_setX"; 1962 Float32x4 withX(double x) native "Float32x4_setX";
2505 Float32x4 withY(double y) native "Float32x4_setY"; 1963 Float32x4 withY(double y) native "Float32x4_setY";
2506 Float32x4 withZ(double z) native "Float32x4_setZ"; 1964 Float32x4 withZ(double z) native "Float32x4_setZ";
2507 Float32x4 withW(double w) native "Float32x4_setW"; 1965 Float32x4 withW(double w) native "Float32x4_setW";
2508 Float32x4 min(Float32x4 other) { 1966 Float32x4 min(Float32x4 other) native "Float32x4_min";
2509 return _min(other); 1967 Float32x4 max(Float32x4 other) native "Float32x4_max";
2510 } 1968 Float32x4 sqrt() native "Float32x4_sqrt";
2511 Float32x4 _min(Float32x4 other) native "Float32x4_min"; 1969 Float32x4 reciprocal() native "Float32x4_reciprocal";
2512 Float32x4 max(Float32x4 other) { 1970 Float32x4 reciprocalSqrt() native "Float32x4_reciprocalSqrt";
2513 return _max(other);
2514 }
2515 Float32x4 _max(Float32x4 other) native "Float32x4_max";
2516 Float32x4 sqrt() {
2517 return _sqrt();
2518 }
2519 Float32x4 _sqrt() native "Float32x4_sqrt";
2520 Float32x4 reciprocal() {
2521 return _reciprocal();
2522 }
2523 Float32x4 _reciprocal() native "Float32x4_reciprocal";
2524 Float32x4 reciprocalSqrt() {
2525 return _reciprocalSqrt();
2526 }
2527 Float32x4 _reciprocalSqrt() native "Float32x4_reciprocalSqrt";
2528
2529 /// Mask passed to [shuffle] or [shuffleMix].
2530 static const int XXXX = 0x0;
2531 static const int XXXY = 0x40;
2532 static const int XXXZ = 0x80;
2533 static const int XXXW = 0xC0;
2534 static const int XXYX = 0x10;
2535 static const int XXYY = 0x50;
2536 static const int XXYZ = 0x90;
2537 static const int XXYW = 0xD0;
2538 static const int XXZX = 0x20;
2539 static const int XXZY = 0x60;
2540 static const int XXZZ = 0xA0;
2541 static const int XXZW = 0xE0;
2542 static const int XXWX = 0x30;
2543 static const int XXWY = 0x70;
2544 static const int XXWZ = 0xB0;
2545 static const int XXWW = 0xF0;
2546 static const int XYXX = 0x4;
2547 static const int XYXY = 0x44;
2548 static const int XYXZ = 0x84;
2549 static const int XYXW = 0xC4;
2550 static const int XYYX = 0x14;
2551 static const int XYYY = 0x54;
2552 static const int XYYZ = 0x94;
2553 static const int XYYW = 0xD4;
2554 static const int XYZX = 0x24;
2555 static const int XYZY = 0x64;
2556 static const int XYZZ = 0xA4;
2557 static const int XYZW = 0xE4;
2558 static const int XYWX = 0x34;
2559 static const int XYWY = 0x74;
2560 static const int XYWZ = 0xB4;
2561 static const int XYWW = 0xF4;
2562 static const int XZXX = 0x8;
2563 static const int XZXY = 0x48;
2564 static const int XZXZ = 0x88;
2565 static const int XZXW = 0xC8;
2566 static const int XZYX = 0x18;
2567 static const int XZYY = 0x58;
2568 static const int XZYZ = 0x98;
2569 static const int XZYW = 0xD8;
2570 static const int XZZX = 0x28;
2571 static const int XZZY = 0x68;
2572 static const int XZZZ = 0xA8;
2573 static const int XZZW = 0xE8;
2574 static const int XZWX = 0x38;
2575 static const int XZWY = 0x78;
2576 static const int XZWZ = 0xB8;
2577 static const int XZWW = 0xF8;
2578 static const int XWXX = 0xC;
2579 static const int XWXY = 0x4C;
2580 static const int XWXZ = 0x8C;
2581 static const int XWXW = 0xCC;
2582 static const int XWYX = 0x1C;
2583 static const int XWYY = 0x5C;
2584 static const int XWYZ = 0x9C;
2585 static const int XWYW = 0xDC;
2586 static const int XWZX = 0x2C;
2587 static const int XWZY = 0x6C;
2588 static const int XWZZ = 0xAC;
2589 static const int XWZW = 0xEC;
2590 static const int XWWX = 0x3C;
2591 static const int XWWY = 0x7C;
2592 static const int XWWZ = 0xBC;
2593 static const int XWWW = 0xFC;
2594 static const int YXXX = 0x1;
2595 static const int YXXY = 0x41;
2596 static const int YXXZ = 0x81;
2597 static const int YXXW = 0xC1;
2598 static const int YXYX = 0x11;
2599 static const int YXYY = 0x51;
2600 static const int YXYZ = 0x91;
2601 static const int YXYW = 0xD1;
2602 static const int YXZX = 0x21;
2603 static const int YXZY = 0x61;
2604 static const int YXZZ = 0xA1;
2605 static const int YXZW = 0xE1;
2606 static const int YXWX = 0x31;
2607 static const int YXWY = 0x71;
2608 static const int YXWZ = 0xB1;
2609 static const int YXWW = 0xF1;
2610 static const int YYXX = 0x5;
2611 static const int YYXY = 0x45;
2612 static const int YYXZ = 0x85;
2613 static const int YYXW = 0xC5;
2614 static const int YYYX = 0x15;
2615 static const int YYYY = 0x55;
2616 static const int YYYZ = 0x95;
2617 static const int YYYW = 0xD5;
2618 static const int YYZX = 0x25;
2619 static const int YYZY = 0x65;
2620 static const int YYZZ = 0xA5;
2621 static const int YYZW = 0xE5;
2622 static const int YYWX = 0x35;
2623 static const int YYWY = 0x75;
2624 static const int YYWZ = 0xB5;
2625 static const int YYWW = 0xF5;
2626 static const int YZXX = 0x9;
2627 static const int YZXY = 0x49;
2628 static const int YZXZ = 0x89;
2629 static const int YZXW = 0xC9;
2630 static const int YZYX = 0x19;
2631 static const int YZYY = 0x59;
2632 static const int YZYZ = 0x99;
2633 static const int YZYW = 0xD9;
2634 static const int YZZX = 0x29;
2635 static const int YZZY = 0x69;
2636 static const int YZZZ = 0xA9;
2637 static const int YZZW = 0xE9;
2638 static const int YZWX = 0x39;
2639 static const int YZWY = 0x79;
2640 static const int YZWZ = 0xB9;
2641 static const int YZWW = 0xF9;
2642 static const int YWXX = 0xD;
2643 static const int YWXY = 0x4D;
2644 static const int YWXZ = 0x8D;
2645 static const int YWXW = 0xCD;
2646 static const int YWYX = 0x1D;
2647 static const int YWYY = 0x5D;
2648 static const int YWYZ = 0x9D;
2649 static const int YWYW = 0xDD;
2650 static const int YWZX = 0x2D;
2651 static const int YWZY = 0x6D;
2652 static const int YWZZ = 0xAD;
2653 static const int YWZW = 0xED;
2654 static const int YWWX = 0x3D;
2655 static const int YWWY = 0x7D;
2656 static const int YWWZ = 0xBD;
2657 static const int YWWW = 0xFD;
2658 static const int ZXXX = 0x2;
2659 static const int ZXXY = 0x42;
2660 static const int ZXXZ = 0x82;
2661 static const int ZXXW = 0xC2;
2662 static const int ZXYX = 0x12;
2663 static const int ZXYY = 0x52;
2664 static const int ZXYZ = 0x92;
2665 static const int ZXYW = 0xD2;
2666 static const int ZXZX = 0x22;
2667 static const int ZXZY = 0x62;
2668 static const int ZXZZ = 0xA2;
2669 static const int ZXZW = 0xE2;
2670 static const int ZXWX = 0x32;
2671 static const int ZXWY = 0x72;
2672 static const int ZXWZ = 0xB2;
2673 static const int ZXWW = 0xF2;
2674 static const int ZYXX = 0x6;
2675 static const int ZYXY = 0x46;
2676 static const int ZYXZ = 0x86;
2677 static const int ZYXW = 0xC6;
2678 static const int ZYYX = 0x16;
2679 static const int ZYYY = 0x56;
2680 static const int ZYYZ = 0x96;
2681 static const int ZYYW = 0xD6;
2682 static const int ZYZX = 0x26;
2683 static const int ZYZY = 0x66;
2684 static const int ZYZZ = 0xA6;
2685 static const int ZYZW = 0xE6;
2686 static const int ZYWX = 0x36;
2687 static const int ZYWY = 0x76;
2688 static const int ZYWZ = 0xB6;
2689 static const int ZYWW = 0xF6;
2690 static const int ZZXX = 0xA;
2691 static const int ZZXY = 0x4A;
2692 static const int ZZXZ = 0x8A;
2693 static const int ZZXW = 0xCA;
2694 static const int ZZYX = 0x1A;
2695 static const int ZZYY = 0x5A;
2696 static const int ZZYZ = 0x9A;
2697 static const int ZZYW = 0xDA;
2698 static const int ZZZX = 0x2A;
2699 static const int ZZZY = 0x6A;
2700 static const int ZZZZ = 0xAA;
2701 static const int ZZZW = 0xEA;
2702 static const int ZZWX = 0x3A;
2703 static const int ZZWY = 0x7A;
2704 static const int ZZWZ = 0xBA;
2705 static const int ZZWW = 0xFA;
2706 static const int ZWXX = 0xE;
2707 static const int ZWXY = 0x4E;
2708 static const int ZWXZ = 0x8E;
2709 static const int ZWXW = 0xCE;
2710 static const int ZWYX = 0x1E;
2711 static const int ZWYY = 0x5E;
2712 static const int ZWYZ = 0x9E;
2713 static const int ZWYW = 0xDE;
2714 static const int ZWZX = 0x2E;
2715 static const int ZWZY = 0x6E;
2716 static const int ZWZZ = 0xAE;
2717 static const int ZWZW = 0xEE;
2718 static const int ZWWX = 0x3E;
2719 static const int ZWWY = 0x7E;
2720 static const int ZWWZ = 0xBE;
2721 static const int ZWWW = 0xFE;
2722 static const int WXXX = 0x3;
2723 static const int WXXY = 0x43;
2724 static const int WXXZ = 0x83;
2725 static const int WXXW = 0xC3;
2726 static const int WXYX = 0x13;
2727 static const int WXYY = 0x53;
2728 static const int WXYZ = 0x93;
2729 static const int WXYW = 0xD3;
2730 static const int WXZX = 0x23;
2731 static const int WXZY = 0x63;
2732 static const int WXZZ = 0xA3;
2733 static const int WXZW = 0xE3;
2734 static const int WXWX = 0x33;
2735 static const int WXWY = 0x73;
2736 static const int WXWZ = 0xB3;
2737 static const int WXWW = 0xF3;
2738 static const int WYXX = 0x7;
2739 static const int WYXY = 0x47;
2740 static const int WYXZ = 0x87;
2741 static const int WYXW = 0xC7;
2742 static const int WYYX = 0x17;
2743 static const int WYYY = 0x57;
2744 static const int WYYZ = 0x97;
2745 static const int WYYW = 0xD7;
2746 static const int WYZX = 0x27;
2747 static const int WYZY = 0x67;
2748 static const int WYZZ = 0xA7;
2749 static const int WYZW = 0xE7;
2750 static const int WYWX = 0x37;
2751 static const int WYWY = 0x77;
2752 static const int WYWZ = 0xB7;
2753 static const int WYWW = 0xF7;
2754 static const int WZXX = 0xB;
2755 static const int WZXY = 0x4B;
2756 static const int WZXZ = 0x8B;
2757 static const int WZXW = 0xCB;
2758 static const int WZYX = 0x1B;
2759 static const int WZYY = 0x5B;
2760 static const int WZYZ = 0x9B;
2761 static const int WZYW = 0xDB;
2762 static const int WZZX = 0x2B;
2763 static const int WZZY = 0x6B;
2764 static const int WZZZ = 0xAB;
2765 static const int WZZW = 0xEB;
2766 static const int WZWX = 0x3B;
2767 static const int WZWY = 0x7B;
2768 static const int WZWZ = 0xBB;
2769 static const int WZWW = 0xFB;
2770 static const int WWXX = 0xF;
2771 static const int WWXY = 0x4F;
2772 static const int WWXZ = 0x8F;
2773 static const int WWXW = 0xCF;
2774 static const int WWYX = 0x1F;
2775 static const int WWYY = 0x5F;
2776 static const int WWYZ = 0x9F;
2777 static const int WWYW = 0xDF;
2778 static const int WWZX = 0x2F;
2779 static const int WWZY = 0x6F;
2780 static const int WWZZ = 0xAF;
2781 static const int WWZW = 0xEF;
2782 static const int WWWX = 0x3F;
2783 static const int WWWY = 0x7F;
2784 static const int WWWZ = 0xBF;
2785 static const int WWWW = 0xFF;
2786
2787 } 1971 }
2788 1972
1973 @patch
1974 class Int32x4 {
1975 @patch
1976 factory Int32x4(int x, int y, int z, int w) native "Int32x4_fromInts";
2789 1977
2790 class Int32x4 { 1978 @patch
2791 factory Int32x4(int x, int y, int z, int w)
2792 native "Int32x4_fromInts";
2793 factory Int32x4.bool(bool x, bool y, bool z, bool w) 1979 factory Int32x4.bool(bool x, bool y, bool z, bool w)
2794 native "Int32x4_fromBools"; 1980 native "Int32x4_fromBools";
1981
1982 @patch
2795 factory Int32x4.fromFloat32x4Bits(Float32x4 x) 1983 factory Int32x4.fromFloat32x4Bits(Float32x4 x)
2796 native "Int32x4_fromFloat32x4Bits"; 1984 native "Int32x4_fromFloat32x4Bits";
2797 Int32x4 operator |(Int32x4 other) { 1985 }
2798 return _or(other); 1986
2799 } 1987 class _Int32x4 implements Int32x4 {
2800 Int32x4 _or(Int32x4 other) native "Int32x4_or"; 1988 Int32x4 operator |(Int32x4 other) native "Int32x4_or";
2801 Int32x4 operator &(Int32x4 other) { 1989 Int32x4 operator &(Int32x4 other) native "Int32x4_and";
2802 return _and(other); 1990 Int32x4 operator ^(Int32x4 other) native "Int32x4_xor";
2803 } 1991 Int32x4 operator +(Int32x4 other) native "Int32x4_add";
2804 Int32x4 _and(Int32x4 other) native "Int32x4_and"; 1992 Int32x4 operator -(Int32x4 other) native "Int32x4_sub";
2805 Int32x4 operator ^(Int32x4 other) {
2806 return _xor(other);
2807 }
2808 Int32x4 _xor(Int32x4 other) native "Int32x4_xor";
2809 Int32x4 operator +(Int32x4 other) {
2810 return _add(other);
2811 }
2812 Int32x4 _add(Int32x4 other) native "Int32x4_add";
2813 Int32x4 operator -(Int32x4 other) {
2814 return _sub(other);
2815 }
2816 Int32x4 _sub(Int32x4 other) native "Int32x4_sub";
2817 int get x native "Int32x4_getX"; 1993 int get x native "Int32x4_getX";
2818 int get y native "Int32x4_getY"; 1994 int get y native "Int32x4_getY";
2819 int get z native "Int32x4_getZ"; 1995 int get z native "Int32x4_getZ";
2820 int get w native "Int32x4_getW"; 1996 int get w native "Int32x4_getW";
2821 int get signMask native "Int32x4_getSignMask"; 1997 int get signMask native "Int32x4_getSignMask";
2822 Int32x4 shuffle(int mask) native "Int32x4_shuffle"; 1998 Int32x4 shuffle(int mask) native "Int32x4_shuffle";
2823 Int32x4 shuffleMix(Int32x4 zw, int mask) native "Int32x4_shuffleMix"; 1999 Int32x4 shuffleMix(Int32x4 zw, int mask) native "Int32x4_shuffleMix";
2824 Int32x4 withX(int x) native "Int32x4_setX"; 2000 Int32x4 withX(int x) native "Int32x4_setX";
2825 Int32x4 withY(int y) native "Int32x4_setY"; 2001 Int32x4 withY(int y) native "Int32x4_setY";
2826 Int32x4 withZ(int z) native "Int32x4_setZ"; 2002 Int32x4 withZ(int z) native "Int32x4_setZ";
2827 Int32x4 withW(int w) native "Int32x4_setW"; 2003 Int32x4 withW(int w) native "Int32x4_setW";
2828 bool get flagX native "Int32x4_getFlagX"; 2004 bool get flagX native "Int32x4_getFlagX";
2829 bool get flagY native "Int32x4_getFlagY"; 2005 bool get flagY native "Int32x4_getFlagY";
2830 bool get flagZ native "Int32x4_getFlagZ"; 2006 bool get flagZ native "Int32x4_getFlagZ";
2831 bool get flagW native "Int32x4_getFlagW"; 2007 bool get flagW native "Int32x4_getFlagW";
2832 Int32x4 withFlagX(bool x) native "Int32x4_setFlagX"; 2008 Int32x4 withFlagX(bool x) native "Int32x4_setFlagX";
2833 Int32x4 withFlagY(bool y) native "Int32x4_setFlagY"; 2009 Int32x4 withFlagY(bool y) native "Int32x4_setFlagY";
2834 Int32x4 withFlagZ(bool z) native "Int32x4_setFlagZ"; 2010 Int32x4 withFlagZ(bool z) native "Int32x4_setFlagZ";
2835 Int32x4 withFlagW(bool w) native "Int32x4_setFlagW"; 2011 Int32x4 withFlagW(bool w) native "Int32x4_setFlagW";
2836 Float32x4 select(Float32x4 trueValue, Float32x4 falseValue) { 2012 Float32x4 select(Float32x4 trueValue, Float32x4 falseValue)
2837 return _select(trueValue, falseValue);
2838 }
2839 Float32x4 _select(Float32x4 trueValue, Float32x4 falseValue)
2840 native "Int32x4_select"; 2013 native "Int32x4_select";
2841
2842 /// Mask passed to [shuffle] or [shuffleMix].
2843 static const int XXXX = 0x0;
2844 static const int XXXY = 0x40;
2845 static const int XXXZ = 0x80;
2846 static const int XXXW = 0xC0;
2847 static const int XXYX = 0x10;
2848 static const int XXYY = 0x50;
2849 static const int XXYZ = 0x90;
2850 static const int XXYW = 0xD0;
2851 static const int XXZX = 0x20;
2852 static const int XXZY = 0x60;
2853 static const int XXZZ = 0xA0;
2854 static const int XXZW = 0xE0;
2855 static const int XXWX = 0x30;
2856 static const int XXWY = 0x70;
2857 static const int XXWZ = 0xB0;
2858 static const int XXWW = 0xF0;
2859 static const int XYXX = 0x4;
2860 static const int XYXY = 0x44;
2861 static const int XYXZ = 0x84;
2862 static const int XYXW = 0xC4;
2863 static const int XYYX = 0x14;
2864 static const int XYYY = 0x54;
2865 static const int XYYZ = 0x94;
2866 static const int XYYW = 0xD4;
2867 static const int XYZX = 0x24;
2868 static const int XYZY = 0x64;
2869 static const int XYZZ = 0xA4;
2870 static const int XYZW = 0xE4;
2871 static const int XYWX = 0x34;
2872 static const int XYWY = 0x74;
2873 static const int XYWZ = 0xB4;
2874 static const int XYWW = 0xF4;
2875 static const int XZXX = 0x8;
2876 static const int XZXY = 0x48;
2877 static const int XZXZ = 0x88;
2878 static const int XZXW = 0xC8;
2879 static const int XZYX = 0x18;
2880 static const int XZYY = 0x58;
2881 static const int XZYZ = 0x98;
2882 static const int XZYW = 0xD8;
2883 static const int XZZX = 0x28;
2884 static const int XZZY = 0x68;
2885 static const int XZZZ = 0xA8;
2886 static const int XZZW = 0xE8;
2887 static const int XZWX = 0x38;
2888 static const int XZWY = 0x78;
2889 static const int XZWZ = 0xB8;
2890 static const int XZWW = 0xF8;
2891 static const int XWXX = 0xC;
2892 static const int XWXY = 0x4C;
2893 static const int XWXZ = 0x8C;
2894 static const int XWXW = 0xCC;
2895 static const int XWYX = 0x1C;
2896 static const int XWYY = 0x5C;
2897 static const int XWYZ = 0x9C;
2898 static const int XWYW = 0xDC;
2899 static const int XWZX = 0x2C;
2900 static const int XWZY = 0x6C;
2901 static const int XWZZ = 0xAC;
2902 static const int XWZW = 0xEC;
2903 static const int XWWX = 0x3C;
2904 static const int XWWY = 0x7C;
2905 static const int XWWZ = 0xBC;
2906 static const int XWWW = 0xFC;
2907 static const int YXXX = 0x1;
2908 static const int YXXY = 0x41;
2909 static const int YXXZ = 0x81;
2910 static const int YXXW = 0xC1;
2911 static const int YXYX = 0x11;
2912 static const int YXYY = 0x51;
2913 static const int YXYZ = 0x91;
2914 static const int YXYW = 0xD1;
2915 static const int YXZX = 0x21;
2916 static const int YXZY = 0x61;
2917 static const int YXZZ = 0xA1;
2918 static const int YXZW = 0xE1;
2919 static const int YXWX = 0x31;
2920 static const int YXWY = 0x71;
2921 static const int YXWZ = 0xB1;
2922 static const int YXWW = 0xF1;
2923 static const int YYXX = 0x5;
2924 static const int YYXY = 0x45;
2925 static const int YYXZ = 0x85;
2926 static const int YYXW = 0xC5;
2927 static const int YYYX = 0x15;
2928 static const int YYYY = 0x55;
2929 static const int YYYZ = 0x95;
2930 static const int YYYW = 0xD5;
2931 static const int YYZX = 0x25;
2932 static const int YYZY = 0x65;
2933 static const int YYZZ = 0xA5;
2934 static const int YYZW = 0xE5;
2935 static const int YYWX = 0x35;
2936 static const int YYWY = 0x75;
2937 static const int YYWZ = 0xB5;
2938 static const int YYWW = 0xF5;
2939 static const int YZXX = 0x9;
2940 static const int YZXY = 0x49;
2941 static const int YZXZ = 0x89;
2942 static const int YZXW = 0xC9;
2943 static const int YZYX = 0x19;
2944 static const int YZYY = 0x59;
2945 static const int YZYZ = 0x99;
2946 static const int YZYW = 0xD9;
2947 static const int YZZX = 0x29;
2948 static const int YZZY = 0x69;
2949 static const int YZZZ = 0xA9;
2950 static const int YZZW = 0xE9;
2951 static const int YZWX = 0x39;
2952 static const int YZWY = 0x79;
2953 static const int YZWZ = 0xB9;
2954 static const int YZWW = 0xF9;
2955 static const int YWXX = 0xD;
2956 static const int YWXY = 0x4D;
2957 static const int YWXZ = 0x8D;
2958 static const int YWXW = 0xCD;
2959 static const int YWYX = 0x1D;
2960 static const int YWYY = 0x5D;
2961 static const int YWYZ = 0x9D;
2962 static const int YWYW = 0xDD;
2963 static const int YWZX = 0x2D;
2964 static const int YWZY = 0x6D;
2965 static const int YWZZ = 0xAD;
2966 static const int YWZW = 0xED;
2967 static const int YWWX = 0x3D;
2968 static const int YWWY = 0x7D;
2969 static const int YWWZ = 0xBD;
2970 static const int YWWW = 0xFD;
2971 static const int ZXXX = 0x2;
2972 static const int ZXXY = 0x42;
2973 static const int ZXXZ = 0x82;
2974 static const int ZXXW = 0xC2;
2975 static const int ZXYX = 0x12;
2976 static const int ZXYY = 0x52;
2977 static const int ZXYZ = 0x92;
2978 static const int ZXYW = 0xD2;
2979 static const int ZXZX = 0x22;
2980 static const int ZXZY = 0x62;
2981 static const int ZXZZ = 0xA2;
2982 static const int ZXZW = 0xE2;
2983 static const int ZXWX = 0x32;
2984 static const int ZXWY = 0x72;
2985 static const int ZXWZ = 0xB2;
2986 static const int ZXWW = 0xF2;
2987 static const int ZYXX = 0x6;
2988 static const int ZYXY = 0x46;
2989 static const int ZYXZ = 0x86;
2990 static const int ZYXW = 0xC6;
2991 static const int ZYYX = 0x16;
2992 static const int ZYYY = 0x56;
2993 static const int ZYYZ = 0x96;
2994 static const int ZYYW = 0xD6;
2995 static const int ZYZX = 0x26;
2996 static const int ZYZY = 0x66;
2997 static const int ZYZZ = 0xA6;
2998 static const int ZYZW = 0xE6;
2999 static const int ZYWX = 0x36;
3000 static const int ZYWY = 0x76;
3001 static const int ZYWZ = 0xB6;
3002 static const int ZYWW = 0xF6;
3003 static const int ZZXX = 0xA;
3004 static const int ZZXY = 0x4A;
3005 static const int ZZXZ = 0x8A;
3006 static const int ZZXW = 0xCA;
3007 static const int ZZYX = 0x1A;
3008 static const int ZZYY = 0x5A;
3009 static const int ZZYZ = 0x9A;
3010 static const int ZZYW = 0xDA;
3011 static const int ZZZX = 0x2A;
3012 static const int ZZZY = 0x6A;
3013 static const int ZZZZ = 0xAA;
3014 static const int ZZZW = 0xEA;
3015 static const int ZZWX = 0x3A;
3016 static const int ZZWY = 0x7A;
3017 static const int ZZWZ = 0xBA;
3018 static const int ZZWW = 0xFA;
3019 static const int ZWXX = 0xE;
3020 static const int ZWXY = 0x4E;
3021 static const int ZWXZ = 0x8E;
3022 static const int ZWXW = 0xCE;
3023 static const int ZWYX = 0x1E;
3024 static const int ZWYY = 0x5E;
3025 static const int ZWYZ = 0x9E;
3026 static const int ZWYW = 0xDE;
3027 static const int ZWZX = 0x2E;
3028 static const int ZWZY = 0x6E;
3029 static const int ZWZZ = 0xAE;
3030 static const int ZWZW = 0xEE;
3031 static const int ZWWX = 0x3E;
3032 static const int ZWWY = 0x7E;
3033 static const int ZWWZ = 0xBE;
3034 static const int ZWWW = 0xFE;
3035 static const int WXXX = 0x3;
3036 static const int WXXY = 0x43;
3037 static const int WXXZ = 0x83;
3038 static const int WXXW = 0xC3;
3039 static const int WXYX = 0x13;
3040 static const int WXYY = 0x53;
3041 static const int WXYZ = 0x93;
3042 static const int WXYW = 0xD3;
3043 static const int WXZX = 0x23;
3044 static const int WXZY = 0x63;
3045 static const int WXZZ = 0xA3;
3046 static const int WXZW = 0xE3;
3047 static const int WXWX = 0x33;
3048 static const int WXWY = 0x73;
3049 static const int WXWZ = 0xB3;
3050 static const int WXWW = 0xF3;
3051 static const int WYXX = 0x7;
3052 static const int WYXY = 0x47;
3053 static const int WYXZ = 0x87;
3054 static const int WYXW = 0xC7;
3055 static const int WYYX = 0x17;
3056 static const int WYYY = 0x57;
3057 static const int WYYZ = 0x97;
3058 static const int WYYW = 0xD7;
3059 static const int WYZX = 0x27;
3060 static const int WYZY = 0x67;
3061 static const int WYZZ = 0xA7;
3062 static const int WYZW = 0xE7;
3063 static const int WYWX = 0x37;
3064 static const int WYWY = 0x77;
3065 static const int WYWZ = 0xB7;
3066 static const int WYWW = 0xF7;
3067 static const int WZXX = 0xB;
3068 static const int WZXY = 0x4B;
3069 static const int WZXZ = 0x8B;
3070 static const int WZXW = 0xCB;
3071 static const int WZYX = 0x1B;
3072 static const int WZYY = 0x5B;
3073 static const int WZYZ = 0x9B;
3074 static const int WZYW = 0xDB;
3075 static const int WZZX = 0x2B;
3076 static const int WZZY = 0x6B;
3077 static const int WZZZ = 0xAB;
3078 static const int WZZW = 0xEB;
3079 static const int WZWX = 0x3B;
3080 static const int WZWY = 0x7B;
3081 static const int WZWZ = 0xBB;
3082 static const int WZWW = 0xFB;
3083 static const int WWXX = 0xF;
3084 static const int WWXY = 0x4F;
3085 static const int WWXZ = 0x8F;
3086 static const int WWXW = 0xCF;
3087 static const int WWYX = 0x1F;
3088 static const int WWYY = 0x5F;
3089 static const int WWYZ = 0x9F;
3090 static const int WWYW = 0xDF;
3091 static const int WWZX = 0x2F;
3092 static const int WWZY = 0x6F;
3093 static const int WWZZ = 0xAF;
3094 static const int WWZW = 0xEF;
3095 static const int WWWX = 0x3F;
3096 static const int WWWY = 0x7F;
3097 static const int WWWZ = 0xBF;
3098 static const int WWWW = 0xFF;
3099
3100 } 2014 }
3101 2015
2016 @patch
2017 class Float64x2 {
2018 @patch
2019 factory Float64x2(double x, double y) native "Float64x2_fromDoubles";
3102 2020
3103 class Float64x2 { 2021 @patch
3104 factory Float64x2(double x, double y) native "Float64x2_fromDoubles";
3105 factory Float64x2.splat(double v) native "Float64x2_splat"; 2022 factory Float64x2.splat(double v) native "Float64x2_splat";
2023
2024 @patch
3106 factory Float64x2.zero() native "Float64x2_zero"; 2025 factory Float64x2.zero() native "Float64x2_zero";
2026
2027 @patch
3107 factory Float64x2.fromFloat32x4(Float32x4 v) native "Float64x2_fromFloat32x4"; 2028 factory Float64x2.fromFloat32x4(Float32x4 v) native "Float64x2_fromFloat32x4";
2029 }
3108 2030
3109 Float64x2 operator +(Float64x2 other) { 2031 class _Float64x2 implements Float64x2 {
3110 return _add(other); 2032 Float64x2 operator +(Float64x2 other) native "Float64x2_add";
3111 } 2033 Float64x2 operator -() native "Float64x2_negate";
3112 Float64x2 _add(Float64x2 other) native "Float64x2_add"; 2034 Float64x2 operator -(Float64x2 other) native "Float64x2_sub";
3113 Float64x2 operator -() { 2035 Float64x2 operator *(Float64x2 other) native "Float64x2_mul";
3114 return _negate(); 2036 Float64x2 operator /(Float64x2 other) native "Float64x2_div";
3115 }
3116 Float64x2 _negate() native "Float64x2_negate";
3117 Float64x2 operator -(Float64x2 other) {
3118 return _sub(other);
3119 }
3120 Float64x2 _sub(Float64x2 other) native "Float64x2_sub";
3121 Float64x2 operator *(Float64x2 other) {
3122 return _mul(other);
3123 }
3124 Float64x2 _mul(Float64x2 other) native "Float64x2_mul";
3125 Float64x2 operator /(Float64x2 other) {
3126 return _div(other);
3127 }
3128 Float64x2 _div(Float64x2 other) native "Float64x2_div";
3129
3130
3131 /// Returns a copy of [this] each lane being scaled by [s].
3132 Float64x2 scale(double s) native "Float64x2_scale"; 2037 Float64x2 scale(double s) native "Float64x2_scale";
3133 /// Returns the absolute value of this [Float64x2].
3134 Float64x2 abs() native "Float64x2_abs"; 2038 Float64x2 abs() native "Float64x2_abs";
3135 2039 Float64x2 clamp(Float64x2 lowerLimit, Float64x2 upperLimit)
3136 /// Clamps [this] to be in the range [lowerLimit]-[upperLimit]. 2040 native "Float64x2_clamp";
3137 Float64x2 clamp(Float64x2 lowerLimit,
3138 Float64x2 upperLimit) native "Float64x2_clamp";
3139
3140 /// Extracted x value.
3141 double get x native "Float64x2_getX"; 2041 double get x native "Float64x2_getX";
3142 /// Extracted y value.
3143 double get y native "Float64x2_getY"; 2042 double get y native "Float64x2_getY";
3144
3145 /// Extract the sign bits from each lane return them in the first 2 bits.
3146 int get signMask native "Float64x2_getSignMask"; 2043 int get signMask native "Float64x2_getSignMask";
3147
3148 /// Returns a new [Float64x2] copied from [this] with a new x value.
3149 Float64x2 withX(double x) native "Float64x2_setX"; 2044 Float64x2 withX(double x) native "Float64x2_setX";
3150 /// Returns a new [Float64x2] copied from [this] with a new y value.
3151 Float64x2 withY(double y) native "Float64x2_setY"; 2045 Float64x2 withY(double y) native "Float64x2_setY";
3152
3153 /// Returns the lane-wise minimum value in [this] or [other].
3154 Float64x2 min(Float64x2 other) native "Float64x2_min"; 2046 Float64x2 min(Float64x2 other) native "Float64x2_min";
3155
3156 /// Returns the lane-wise maximum value in [this] or [other].
3157 Float64x2 max(Float64x2 other) native "Float64x2_max"; 2047 Float64x2 max(Float64x2 other) native "Float64x2_max";
3158
3159 /// Returns the lane-wise square root of [this].
3160 Float64x2 sqrt() native "Float64x2_sqrt"; 2048 Float64x2 sqrt() native "Float64x2_sqrt";
3161 } 2049 }
3162 2050
3163
3164
3165 class _TypedListIterator<E> implements Iterator<E> { 2051 class _TypedListIterator<E> implements Iterator<E> {
3166 final List<E> _array; 2052 final List<E> _array;
3167 final int _length; 2053 final int _length;
3168 int _position; 2054 int _position;
3169 E _current; 2055 E _current;
3170 2056
3171 _TypedListIterator(List array) 2057 _TypedListIterator(List array)
3172 : _array = array, _length = array.length, _position = -1 { 2058 : _array = array,
2059 _length = array.length,
2060 _position = -1 {
3173 assert(array is _TypedList || array is _TypedListView); 2061 assert(array is _TypedList || array is _TypedListView);
3174 } 2062 }
3175 2063
3176 bool moveNext() { 2064 bool moveNext() {
3177 int nextPosition = _position + 1; 2065 int nextPosition = _position + 1;
3178 if (nextPosition < _length) { 2066 if (nextPosition < _length) {
3179 _current = _array[nextPosition]; 2067 _current = _array[nextPosition];
3180 _position = nextPosition; 2068 _position = nextPosition;
3181 return true; 2069 return true;
3182 } 2070 }
3183 _position = _length; 2071 _position = _length;
3184 _current = null; 2072 _current = null;
3185 return false; 2073 return false;
3186 } 2074 }
3187 2075
3188 E get current => _current; 2076 E get current => _current;
3189 } 2077 }
3190 2078
3191
3192 class _TypedListView extends _TypedListBase implements TypedData { 2079 class _TypedListView extends _TypedListBase implements TypedData {
3193 _TypedListView(ByteBuffer _buffer, int _offset, int _length) 2080 _TypedListView(_ByteBuffer _buffer, int _offset, int _length)
3194 : _typedData = _buffer._data, 2081 : _typedData = _buffer._data,
3195 offsetInBytes = _offset, 2082 offsetInBytes = _offset,
3196 length = _length { 2083 length = _length {}
3197 }
3198 2084
3199 // Method(s) implementing the TypedData interface. 2085 // Method(s) implementing the TypedData interface.
3200 2086
3201 int get lengthInBytes { 2087 int get lengthInBytes {
3202 return length * elementSizeInBytes; 2088 return length * elementSizeInBytes;
3203 } 2089 }
3204 2090
3205 ByteBuffer get buffer { 2091 _ByteBuffer get buffer {
3206 return _typedData.buffer; 2092 return _typedData.buffer;
3207 } 2093 }
3208 2094
3209 final _TypedList _typedData; 2095 final _TypedList _typedData;
3210 final int offsetInBytes; 2096 final int offsetInBytes;
3211 final int length; 2097 final int length;
3212 } 2098 }
3213 2099
3214 2100 class _Int8ArrayView extends _TypedListView
3215 class _Int8ArrayView extends _TypedListView with _IntListMixin implements Int8Li st { 2101 with _IntListMixin
2102 implements Int8List {
3216 // Constructor. 2103 // Constructor.
3217 _Int8ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length]) 2104 _Int8ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
3218 : super(buffer, _offsetInBytes, 2105 : super(
3219 _defaultIfNull(_length, 2106 buffer,
3220 ((buffer.lengthInBytes - _offsetInBytes) ~/ 2107 _offsetInBytes,
3221 Int8List.BYTES_PER_ELEMENT))) { 2108 _defaultIfNull(
3222 _rangeCheck(buffer.lengthInBytes, 2109 _length,
3223 _offsetInBytes, 2110 ((buffer.lengthInBytes - _offsetInBytes) ~/
3224 length * Int8List.BYTES_PER_ELEMENT); 2111 Int8List.BYTES_PER_ELEMENT))) {
2112 _rangeCheck(buffer.lengthInBytes, _offsetInBytes,
2113 length * Int8List.BYTES_PER_ELEMENT);
3225 } 2114 }
3226 2115
3227
3228 // Method(s) implementing List interface. 2116 // Method(s) implementing List interface.
3229 2117 int operator [](int index) {
3230 int operator[](int index) {
3231 if (index < 0 || index >= length) { 2118 if (index < 0 || index >= length) {
3232 throw new RangeError.index(index, this, "index"); 2119 throw new RangeError.index(index, this, "index");
3233 } 2120 }
3234 return _typedData._getInt8(offsetInBytes + 2121 return _typedData
3235 (index * Int8List.BYTES_PER_ELEMENT)); 2122 ._getInt8(offsetInBytes + (index * Int8List.BYTES_PER_ELEMENT));
3236 } 2123 }
3237 2124
3238 void operator[]=(int index, int value) { 2125 void operator []=(int index, int value) {
3239 if (index < 0 || index >= length) { 2126 if (index < 0 || index >= length) {
3240 throw new RangeError.index(index, this, "index"); 2127 throw new RangeError.index(index, this, "index");
3241 } 2128 }
3242 _typedData._setInt8(offsetInBytes + (index * Int8List.BYTES_PER_ELEMENT), 2129 _typedData._setInt8(
3243 _toInt8(value)); 2130 offsetInBytes + (index * Int8List.BYTES_PER_ELEMENT), _toInt8(value));
3244 } 2131 }
3245 2132
3246
3247 // Method(s) implementing TypedData interface. 2133 // Method(s) implementing TypedData interface.
3248
3249 int get elementSizeInBytes { 2134 int get elementSizeInBytes {
3250 return Int8List.BYTES_PER_ELEMENT; 2135 return Int8List.BYTES_PER_ELEMENT;
3251 } 2136 }
3252 2137
3253
3254 // Internal utility methods. 2138 // Internal utility methods.
3255
3256 Int8List _createList(int length) { 2139 Int8List _createList(int length) {
3257 return new Int8List(length); 2140 return new Int8List(length);
3258 } 2141 }
3259 } 2142 }
3260 2143
3261 2144 class _Uint8ArrayView extends _TypedListView
3262 class _Uint8ArrayView extends _TypedListView with _IntListMixin implements Uint8 List { 2145 with _IntListMixin
2146 implements Uint8List {
3263 // Constructor. 2147 // Constructor.
3264 _Uint8ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length]) 2148 _Uint8ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
3265 : super(buffer, _offsetInBytes, 2149 : super(
3266 _defaultIfNull(_length, 2150 buffer,
3267 ((buffer.lengthInBytes - _offsetInBytes) ~/ 2151 _offsetInBytes,
3268 Uint8List.BYTES_PER_ELEMENT))) { 2152 _defaultIfNull(
3269 _rangeCheck(buffer.lengthInBytes, 2153 _length,
3270 _offsetInBytes, 2154 ((buffer.lengthInBytes - _offsetInBytes) ~/
3271 length * Uint8List.BYTES_PER_ELEMENT); 2155 Uint8List.BYTES_PER_ELEMENT))) {
2156 _rangeCheck(buffer.lengthInBytes, _offsetInBytes,
2157 length * Uint8List.BYTES_PER_ELEMENT);
3272 } 2158 }
3273 2159
3274
3275 // Method(s) implementing List interface. 2160 // Method(s) implementing List interface.
3276 2161 int operator [](int index) {
3277 int operator[](int index) {
3278 if (index < 0 || index >= length) { 2162 if (index < 0 || index >= length) {
3279 throw new RangeError.index(index, this, "index"); 2163 throw new RangeError.index(index, this, "index");
3280 } 2164 }
3281 return _typedData._getUint8(offsetInBytes + 2165 return _typedData
3282 (index * Uint8List.BYTES_PER_ELEMENT)); 2166 ._getUint8(offsetInBytes + (index * Uint8List.BYTES_PER_ELEMENT));
3283 } 2167 }
3284 2168
3285 void operator[]=(int index, int value) { 2169 void operator []=(int index, int value) {
3286 if (index < 0 || index >= length) { 2170 if (index < 0 || index >= length) {
3287 throw new RangeError.index(index, this, "index"); 2171 throw new RangeError.index(index, this, "index");
3288 } 2172 }
3289 _typedData._setUint8(offsetInBytes + (index * Uint8List.BYTES_PER_ELEMENT), 2173 _typedData._setUint8(
3290 _toUint8(value)); 2174 offsetInBytes + (index * Uint8List.BYTES_PER_ELEMENT), _toUint8(value));
3291 } 2175 }
3292 2176
3293
3294 // Method(s) implementing TypedData interface. 2177 // Method(s) implementing TypedData interface.
3295
3296 int get elementSizeInBytes { 2178 int get elementSizeInBytes {
3297 return Uint8List.BYTES_PER_ELEMENT; 2179 return Uint8List.BYTES_PER_ELEMENT;
3298 } 2180 }
3299 2181
3300
3301 // Internal utility methods. 2182 // Internal utility methods.
3302
3303 Uint8List _createList(int length) { 2183 Uint8List _createList(int length) {
3304 return new Uint8List(length); 2184 return new Uint8List(length);
3305 } 2185 }
3306 } 2186 }
3307 2187
3308 2188 class _Uint8ClampedArrayView extends _TypedListView
3309 class _Uint8ClampedArrayView extends _TypedListView with _IntListMixin implement s Uint8ClampedList { 2189 with _IntListMixin
2190 implements Uint8ClampedList {
3310 // Constructor. 2191 // Constructor.
3311 _Uint8ClampedArrayView(ByteBuffer buffer, 2192 _Uint8ClampedArrayView(_ByteBuffer buffer,
3312 [int _offsetInBytes = 0, int _length]) 2193 [int _offsetInBytes = 0, int _length])
3313 : super(buffer, _offsetInBytes, 2194 : super(
3314 _defaultIfNull(_length, 2195 buffer,
3315 ((buffer.lengthInBytes - _offsetInBytes) ~/ 2196 _offsetInBytes,
3316 Uint8List.BYTES_PER_ELEMENT))) { 2197 _defaultIfNull(
3317 _rangeCheck(buffer.lengthInBytes, 2198 _length,
3318 offsetInBytes, 2199 ((buffer.lengthInBytes - _offsetInBytes) ~/
3319 length * Uint8List.BYTES_PER_ELEMENT); 2200 Uint8List.BYTES_PER_ELEMENT))) {
2201 _rangeCheck(buffer.lengthInBytes, offsetInBytes,
2202 length * Uint8List.BYTES_PER_ELEMENT);
3320 } 2203 }
3321 2204
3322
3323 // Method(s) implementing List interface. 2205 // Method(s) implementing List interface.
3324 2206 int operator [](int index) {
3325 int operator[](int index) {
3326 if (index < 0 || index >= length) { 2207 if (index < 0 || index >= length) {
3327 throw new RangeError.index(index, this, "index"); 2208 throw new RangeError.index(index, this, "index");
3328 } 2209 }
3329 return _typedData._getUint8(offsetInBytes + 2210 return _typedData
3330 (index * Uint8List.BYTES_PER_ELEMENT)); 2211 ._getUint8(offsetInBytes + (index * Uint8List.BYTES_PER_ELEMENT));
3331 } 2212 }
3332 2213
3333 void operator[]=(int index, int value) { 2214 void operator []=(int index, int value) {
3334 if (index < 0 || index >= length) { 2215 if (index < 0 || index >= length) {
3335 throw new RangeError.index(index, this, "index"); 2216 throw new RangeError.index(index, this, "index");
3336 } 2217 }
3337 _typedData._setUint8(offsetInBytes + (index * Uint8List.BYTES_PER_ELEMENT), 2218 _typedData._setUint8(offsetInBytes + (index * Uint8List.BYTES_PER_ELEMENT),
3338 _toClampedUint8(value)); 2219 _toClampedUint8(value));
3339 } 2220 }
3340 2221
3341
3342 // Method(s) implementing TypedData interface. 2222 // Method(s) implementing TypedData interface.
3343
3344 int get elementSizeInBytes { 2223 int get elementSizeInBytes {
3345 return Uint8List.BYTES_PER_ELEMENT; 2224 return Uint8List.BYTES_PER_ELEMENT;
3346 } 2225 }
3347 2226
3348
3349 // Internal utility methods. 2227 // Internal utility methods.
3350
3351 Uint8ClampedList _createList(int length) { 2228 Uint8ClampedList _createList(int length) {
3352 return new Uint8ClampedList(length); 2229 return new Uint8ClampedList(length);
3353 } 2230 }
3354 } 2231 }
3355 2232
3356 2233 class _Int16ArrayView extends _TypedListView
3357 class _Int16ArrayView extends _TypedListView with _IntListMixin implements Int16 List { 2234 with _IntListMixin
2235 implements Int16List {
3358 // Constructor. 2236 // Constructor.
3359 _Int16ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length]) 2237 _Int16ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
3360 : super(buffer, _offsetInBytes, 2238 : super(
3361 _defaultIfNull(_length, 2239 buffer,
3362 ((buffer.lengthInBytes - _offsetInBytes) ~/ 2240 _offsetInBytes,
3363 Int16List.BYTES_PER_ELEMENT))) { 2241 _defaultIfNull(
3364 _rangeCheck(buffer.lengthInBytes, 2242 _length,
3365 offsetInBytes, 2243 ((buffer.lengthInBytes - _offsetInBytes) ~/
3366 length * Int16List.BYTES_PER_ELEMENT); 2244 Int16List.BYTES_PER_ELEMENT))) {
2245 _rangeCheck(buffer.lengthInBytes, offsetInBytes,
2246 length * Int16List.BYTES_PER_ELEMENT);
3367 _offsetAlignmentCheck(_offsetInBytes, Int16List.BYTES_PER_ELEMENT); 2247 _offsetAlignmentCheck(_offsetInBytes, Int16List.BYTES_PER_ELEMENT);
3368 } 2248 }
3369 2249
3370
3371 // Method(s) implementing List interface. 2250 // Method(s) implementing List interface.
3372 2251 int operator [](int index) {
3373 int operator[](int index) {
3374 if (index < 0 || index >= length) { 2252 if (index < 0 || index >= length) {
3375 throw new RangeError.index(index, this, "index"); 2253 throw new RangeError.index(index, this, "index");
3376 } 2254 }
3377 return _typedData._getInt16(offsetInBytes + 2255 return _typedData
3378 (index * Int16List.BYTES_PER_ELEMENT)); 2256 ._getInt16(offsetInBytes + (index * Int16List.BYTES_PER_ELEMENT));
3379 } 2257 }
3380 2258
3381 void operator[]=(int index, int value) { 2259 void operator []=(int index, int value) {
3382 if (index < 0 || index >= length) { 2260 if (index < 0 || index >= length) {
3383 throw new RangeError.index(index, this, "index"); 2261 throw new RangeError.index(index, this, "index");
3384 } 2262 }
3385 _typedData._setInt16(offsetInBytes + (index * Int16List.BYTES_PER_ELEMENT), 2263 _typedData._setInt16(
3386 _toInt16(value)); 2264 offsetInBytes + (index * Int16List.BYTES_PER_ELEMENT), _toInt16(value));
3387 } 2265 }
3388 2266
3389 void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) { 2267 void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) {
3390 if (iterable is CodeUnits) { 2268 if (iterable is CodeUnits) {
3391 end = RangeError.checkValidRange(start, end, this.length); 2269 end = RangeError.checkValidRange(start, end, this.length);
3392 int length = end - start; 2270 int length = end - start;
3393 int byteStart = this.offsetInBytes + start * Int16List.BYTES_PER_ELEMENT; 2271 int byteStart = this.offsetInBytes + start * Int16List.BYTES_PER_ELEMENT;
3394 _typedData._setCodeUnits(iterable, byteStart, length, skipCount); 2272 _typedData._setCodeUnits(iterable, byteStart, length, skipCount);
3395 } else { 2273 } else {
3396 super.setRange(start, end, iterable, skipCount); 2274 super.setRange(start, end, iterable, skipCount);
3397 } 2275 }
3398 } 2276 }
3399 2277
3400 // Method(s) implementing TypedData interface. 2278 // Method(s) implementing TypedData interface.
3401 2279
3402 int get elementSizeInBytes { 2280 int get elementSizeInBytes {
3403 return Int16List.BYTES_PER_ELEMENT; 2281 return Int16List.BYTES_PER_ELEMENT;
3404 } 2282 }
3405 2283
3406
3407 // Internal utility methods. 2284 // Internal utility methods.
3408
3409 Int16List _createList(int length) { 2285 Int16List _createList(int length) {
3410 return new Int16List(length); 2286 return new Int16List(length);
3411 } 2287 }
3412 } 2288 }
3413 2289
3414 2290 class _Uint16ArrayView extends _TypedListView
3415 class _Uint16ArrayView extends _TypedListView with _IntListMixin implements Uint 16List { 2291 with _IntListMixin
2292 implements Uint16List {
3416 // Constructor. 2293 // Constructor.
3417 _Uint16ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length]) 2294 _Uint16ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
3418 : super(buffer, _offsetInBytes, 2295 : super(
3419 _defaultIfNull(_length, 2296 buffer,
3420 ((buffer.lengthInBytes - _offsetInBytes) ~/ 2297 _offsetInBytes,
3421 Uint16List.BYTES_PER_ELEMENT))) { 2298 _defaultIfNull(
3422 _rangeCheck(buffer.lengthInBytes, 2299 _length,
3423 offsetInBytes, 2300 ((buffer.lengthInBytes - _offsetInBytes) ~/
3424 length * Uint16List.BYTES_PER_ELEMENT); 2301 Uint16List.BYTES_PER_ELEMENT))) {
2302 _rangeCheck(buffer.lengthInBytes, offsetInBytes,
2303 length * Uint16List.BYTES_PER_ELEMENT);
3425 _offsetAlignmentCheck(_offsetInBytes, Uint16List.BYTES_PER_ELEMENT); 2304 _offsetAlignmentCheck(_offsetInBytes, Uint16List.BYTES_PER_ELEMENT);
3426 } 2305 }
3427 2306
3428
3429 // Method(s) implementing List interface. 2307 // Method(s) implementing List interface.
3430 2308 int operator [](int index) {
3431 int operator[](int index) {
3432 if (index < 0 || index >= length) { 2309 if (index < 0 || index >= length) {
3433 throw new RangeError.index(index, this, "index"); 2310 throw new RangeError.index(index, this, "index");
3434 } 2311 }
3435 return _typedData._getUint16(offsetInBytes + 2312 return _typedData
3436 (index * Uint16List.BYTES_PER_ELEMENT)); 2313 ._getUint16(offsetInBytes + (index * Uint16List.BYTES_PER_ELEMENT));
3437 } 2314 }
3438 2315
3439 void operator[]=(int index, int value) { 2316 void operator []=(int index, int value) {
3440 if (index < 0 || index >= length) { 2317 if (index < 0 || index >= length) {
3441 throw new RangeError.index(index, this, "index"); 2318 throw new RangeError.index(index, this, "index");
3442 } 2319 }
3443 _typedData._setUint16(offsetInBytes + (index * Uint16List.BYTES_PER_ELEMENT) , 2320 _typedData._setUint16(
3444 _toUint16(value)); 2321 offsetInBytes + (index * Uint16List.BYTES_PER_ELEMENT),
2322 _toUint16(value));
3445 } 2323 }
3446 2324
3447 void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) { 2325 void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) {
3448 if (iterable is CodeUnits) { 2326 if (iterable is CodeUnits) {
3449 end = RangeError.checkValidRange(start, end, this.length); 2327 end = RangeError.checkValidRange(start, end, this.length);
3450 int length = end - start; 2328 int length = end - start;
3451 int byteStart = this.offsetInBytes + start * Uint16List.BYTES_PER_ELEMENT; 2329 int byteStart = this.offsetInBytes + start * Uint16List.BYTES_PER_ELEMENT;
3452 _typedData._setCodeUnits(iterable, byteStart, length, skipCount); 2330 _typedData._setCodeUnits(iterable, byteStart, length, skipCount);
3453 } else { 2331 } else {
3454 super.setRange(start, end, iterable, skipCount); 2332 super.setRange(start, end, iterable, skipCount);
3455 } 2333 }
3456 } 2334 }
3457 2335
3458 // Method(s) implementing TypedData interface. 2336 // Method(s) implementing TypedData interface.
3459 2337
3460 int get elementSizeInBytes { 2338 int get elementSizeInBytes {
3461 return Uint16List.BYTES_PER_ELEMENT; 2339 return Uint16List.BYTES_PER_ELEMENT;
3462 } 2340 }
3463 2341
3464 // Internal utility methods. 2342 // Internal utility methods.
3465 2343
3466 Uint16List _createList(int length) { 2344 Uint16List _createList(int length) {
3467 return new Uint16List(length); 2345 return new Uint16List(length);
3468 } 2346 }
3469 } 2347 }
3470 2348
3471 2349 class _Int32ArrayView extends _TypedListView
3472 class _Int32ArrayView extends _TypedListView with _IntListMixin implements Int32 List { 2350 with _IntListMixin
3473 // Constructor. 2351 implements Int32List {
3474 _Int32ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length]) 2352 // Constructor.
3475 : super(buffer, _offsetInBytes, 2353 _Int32ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
3476 _defaultIfNull(_length, 2354 : super(
3477 ((buffer.lengthInBytes - _offsetInBytes) ~/ 2355 buffer,
3478 Int32List.BYTES_PER_ELEMENT))) { 2356 _offsetInBytes,
3479 _rangeCheck(buffer.lengthInBytes, 2357 _defaultIfNull(
3480 offsetInBytes, 2358 _length,
3481 length * Int32List.BYTES_PER_ELEMENT); 2359 ((buffer.lengthInBytes - _offsetInBytes) ~/
2360 Int32List.BYTES_PER_ELEMENT))) {
2361 _rangeCheck(buffer.lengthInBytes, offsetInBytes,
2362 length * Int32List.BYTES_PER_ELEMENT);
3482 _offsetAlignmentCheck(_offsetInBytes, Int32List.BYTES_PER_ELEMENT); 2363 _offsetAlignmentCheck(_offsetInBytes, Int32List.BYTES_PER_ELEMENT);
3483 } 2364 }
3484 2365
3485 2366 // Method(s) implementing List interface.
3486 // Method(s) implementing List interface. 2367 int operator [](int index) {
3487 2368 if (index < 0 || index >= length) {
3488 int operator[](int index) { 2369 throw new RangeError.index(index, this, "index");
3489 if (index < 0 || index >= length) { 2370 }
3490 throw new RangeError.index(index, this, "index"); 2371 return _typedData
3491 } 2372 ._getInt32(offsetInBytes + (index * Int32List.BYTES_PER_ELEMENT));
3492 return _typedData._getInt32(offsetInBytes + 2373 }
3493 (index * Int32List.BYTES_PER_ELEMENT)); 2374
3494 } 2375 void operator []=(int index, int value) {
3495 2376 if (index < 0 || index >= length) {
3496 void operator[]=(int index, int value) { 2377 throw new RangeError.index(index, this, "index");
3497 if (index < 0 || index >= length) { 2378 }
3498 throw new RangeError.index(index, this, "index"); 2379 _typedData._setInt32(
3499 } 2380 offsetInBytes + (index * Int32List.BYTES_PER_ELEMENT), _toInt32(value));
3500 _typedData._setInt32(offsetInBytes + (index * Int32List.BYTES_PER_ELEMENT), 2381 }
3501 _toInt32(value)); 2382
3502 } 2383 // Method(s) implementing TypedData interface.
3503
3504
3505 // Method(s) implementing TypedData interface.
3506
3507 int get elementSizeInBytes { 2384 int get elementSizeInBytes {
3508 return Int32List.BYTES_PER_ELEMENT; 2385 return Int32List.BYTES_PER_ELEMENT;
3509 } 2386 }
3510 2387
3511 2388 // Internal utility methods.
3512 // Internal utility methods.
3513
3514 Int32List _createList(int length) { 2389 Int32List _createList(int length) {
3515 return new Int32List(length); 2390 return new Int32List(length);
3516 } 2391 }
3517 } 2392 }
3518 2393
3519 2394 class _Uint32ArrayView extends _TypedListView
3520 class _Uint32ArrayView extends _TypedListView with _IntListMixin implements Uint 32List { 2395 with _IntListMixin
3521 // Constructor. 2396 implements Uint32List {
3522 _Uint32ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length]) 2397 // Constructor.
3523 : super(buffer, _offsetInBytes, 2398 _Uint32ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
3524 _defaultIfNull(_length, 2399 : super(
3525 ((buffer.lengthInBytes - _offsetInBytes) ~/ 2400 buffer,
3526 Uint32List.BYTES_PER_ELEMENT))) { 2401 _offsetInBytes,
3527 _rangeCheck(buffer.lengthInBytes, 2402 _defaultIfNull(
3528 offsetInBytes, 2403 _length,
3529 length * Uint32List.BYTES_PER_ELEMENT); 2404 ((buffer.lengthInBytes - _offsetInBytes) ~/
2405 Uint32List.BYTES_PER_ELEMENT))) {
2406 _rangeCheck(buffer.lengthInBytes, offsetInBytes,
2407 length * Uint32List.BYTES_PER_ELEMENT);
3530 _offsetAlignmentCheck(_offsetInBytes, Uint32List.BYTES_PER_ELEMENT); 2408 _offsetAlignmentCheck(_offsetInBytes, Uint32List.BYTES_PER_ELEMENT);
3531 } 2409 }
3532 2410
3533 2411 // Method(s) implementing List interface.
3534 // Method(s) implementing List interface. 2412 int operator [](int index) {
3535 2413 if (index < 0 || index >= length) {
3536 int operator[](int index) { 2414 throw new RangeError.index(index, this, "index");
3537 if (index < 0 || index >= length) { 2415 }
3538 throw new RangeError.index(index, this, "index"); 2416 return _typedData
3539 } 2417 ._getUint32(offsetInBytes + (index * Uint32List.BYTES_PER_ELEMENT));
3540 return _typedData._getUint32(offsetInBytes + 2418 }
3541 (index * Uint32List.BYTES_PER_ELEMENT)); 2419
3542 } 2420 void operator []=(int index, int value) {
3543 2421 if (index < 0 || index >= length) {
3544 void operator[]=(int index, int value) { 2422 throw new RangeError.index(index, this, "index");
3545 if (index < 0 || index >= length) { 2423 }
3546 throw new RangeError.index(index, this, "index"); 2424 _typedData._setUint32(
3547 } 2425 offsetInBytes + (index * Uint32List.BYTES_PER_ELEMENT),
3548 _typedData._setUint32(offsetInBytes + (index * Uint32List.BYTES_PER_ELEMENT) , 2426 _toUint32(value));
3549 _toUint32(value)); 2427 }
3550 } 2428
3551 2429 // Method(s) implementing TypedData interface.
3552
3553 // Method(s) implementing TypedData interface.
3554
3555 int get elementSizeInBytes { 2430 int get elementSizeInBytes {
3556 return Uint32List.BYTES_PER_ELEMENT; 2431 return Uint32List.BYTES_PER_ELEMENT;
3557 } 2432 }
3558 2433
3559 2434 // Internal utility methods.
3560 // Internal utility methods.
3561
3562 Uint32List _createList(int length) { 2435 Uint32List _createList(int length) {
3563 return new Uint32List(length); 2436 return new Uint32List(length);
3564 } 2437 }
3565 } 2438 }
3566 2439
3567 2440 class _Int64ArrayView extends _TypedListView
3568 class _Int64ArrayView extends _TypedListView with _IntListMixin implements Int64 List { 2441 with _IntListMixin
3569 // Constructor. 2442 implements Int64List {
3570 _Int64ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length]) 2443 // Constructor.
3571 : super(buffer, _offsetInBytes, 2444 _Int64ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
3572 _defaultIfNull(_length, 2445 : super(
3573 ((buffer.lengthInBytes - _offsetInBytes) ~/ 2446 buffer,
3574 Int64List.BYTES_PER_ELEMENT))) { 2447 _offsetInBytes,
3575 _rangeCheck(buffer.lengthInBytes, 2448 _defaultIfNull(
3576 offsetInBytes, 2449 _length,
3577 length * Int64List.BYTES_PER_ELEMENT); 2450 ((buffer.lengthInBytes - _offsetInBytes) ~/
2451 Int64List.BYTES_PER_ELEMENT))) {
2452 _rangeCheck(buffer.lengthInBytes, offsetInBytes,
2453 length * Int64List.BYTES_PER_ELEMENT);
3578 _offsetAlignmentCheck(_offsetInBytes, Int64List.BYTES_PER_ELEMENT); 2454 _offsetAlignmentCheck(_offsetInBytes, Int64List.BYTES_PER_ELEMENT);
3579 } 2455 }
3580 2456
3581 2457 // Method(s) implementing List interface.
3582 // Method(s) implementing List interface. 2458 int operator [](int index) {
3583 2459 if (index < 0 || index >= length) {
3584 int operator[](int index) { 2460 throw new RangeError.index(index, this, "index");
3585 if (index < 0 || index >= length) { 2461 }
3586 throw new RangeError.index(index, this, "index"); 2462 return _typedData
3587 } 2463 ._getInt64(offsetInBytes + (index * Int64List.BYTES_PER_ELEMENT));
3588 return _typedData._getInt64(offsetInBytes + 2464 }
3589 (index * Int64List.BYTES_PER_ELEMENT)); 2465
3590 } 2466 void operator []=(int index, int value) {
3591 2467 if (index < 0 || index >= length) {
3592 void operator[]=(int index, int value) { 2468 throw new RangeError.index(index, this, "index");
3593 if (index < 0 || index >= length) { 2469 }
3594 throw new RangeError.index(index, this, "index"); 2470 _typedData._setInt64(
3595 } 2471 offsetInBytes + (index * Int64List.BYTES_PER_ELEMENT), _toInt64(value));
3596 _typedData._setInt64(offsetInBytes + (index * Int64List.BYTES_PER_ELEMENT), 2472 }
3597 _toInt64(value)); 2473
3598 } 2474 // Method(s) implementing TypedData interface.
3599
3600
3601 // Method(s) implementing TypedData interface.
3602
3603 int get elementSizeInBytes { 2475 int get elementSizeInBytes {
3604 return Int64List.BYTES_PER_ELEMENT; 2476 return Int64List.BYTES_PER_ELEMENT;
3605 } 2477 }
3606 2478
3607 2479 // Internal utility methods.
3608 // Internal utility methods.
3609
3610 Int64List _createList(int length) { 2480 Int64List _createList(int length) {
3611 return new Int64List(length); 2481 return new Int64List(length);
3612 } 2482 }
3613 } 2483 }
3614 2484
3615 2485 class _Uint64ArrayView extends _TypedListView
3616 class _Uint64ArrayView extends _TypedListView with _IntListMixin implements Uint 64List { 2486 with _IntListMixin
3617 // Constructor. 2487 implements Uint64List {
3618 _Uint64ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length]) 2488 // Constructor.
3619 : super(buffer, _offsetInBytes, 2489 _Uint64ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
3620 _defaultIfNull(_length, 2490 : super(
3621 ((buffer.lengthInBytes - _offsetInBytes) ~/ 2491 buffer,
3622 Uint64List.BYTES_PER_ELEMENT))) { 2492 _offsetInBytes,
3623 _rangeCheck(buffer.lengthInBytes, 2493 _defaultIfNull(
3624 offsetInBytes, 2494 _length,
3625 length * Uint64List.BYTES_PER_ELEMENT); 2495 ((buffer.lengthInBytes - _offsetInBytes) ~/
2496 Uint64List.BYTES_PER_ELEMENT))) {
2497 _rangeCheck(buffer.lengthInBytes, offsetInBytes,
2498 length * Uint64List.BYTES_PER_ELEMENT);
3626 _offsetAlignmentCheck(_offsetInBytes, Uint64List.BYTES_PER_ELEMENT); 2499 _offsetAlignmentCheck(_offsetInBytes, Uint64List.BYTES_PER_ELEMENT);
3627 } 2500 }
3628 2501
3629 2502 // Method(s) implementing List interface.
3630 // Method(s) implementing List interface. 2503 int operator [](int index) {
3631 2504 if (index < 0 || index >= length) {
3632 int operator[](int index) { 2505 throw new RangeError.index(index, this, "index");
3633 if (index < 0 || index >= length) { 2506 }
3634 throw new RangeError.index(index, this, "index"); 2507 return _typedData
3635 } 2508 ._getUint64(offsetInBytes + (index * Uint64List.BYTES_PER_ELEMENT));
3636 return _typedData._getUint64(offsetInBytes + 2509 }
3637 (index * Uint64List.BYTES_PER_ELEMENT)); 2510
3638 } 2511 void operator []=(int index, int value) {
3639 2512 if (index < 0 || index >= length) {
3640 void operator[]=(int index, int value) { 2513 throw new RangeError.index(index, this, "index");
3641 if (index < 0 || index >= length) { 2514 }
3642 throw new RangeError.index(index, this, "index"); 2515 _typedData._setUint64(
3643 } 2516 offsetInBytes + (index * Uint64List.BYTES_PER_ELEMENT),
3644 _typedData._setUint64(offsetInBytes + (index * Uint64List.BYTES_PER_ELEMENT) , 2517 _toUint64(value));
3645 _toUint64(value)); 2518 }
3646 } 2519
3647 2520 // Method(s) implementing TypedData interface.
3648
3649 // Method(s) implementing TypedData interface.
3650
3651 int get elementSizeInBytes { 2521 int get elementSizeInBytes {
3652 return Uint64List.BYTES_PER_ELEMENT; 2522 return Uint64List.BYTES_PER_ELEMENT;
3653 } 2523 }
3654 2524
3655 2525 // Internal utility methods.
3656 // Internal utility methods.
3657
3658 Uint64List _createList(int length) { 2526 Uint64List _createList(int length) {
3659 return new Uint64List(length); 2527 return new Uint64List(length);
3660 } 2528 }
3661 } 2529 }
3662 2530
3663 2531 class _Float32ArrayView extends _TypedListView
3664 class _Float32ArrayView extends _TypedListView with _DoubleListMixin implements Float32List { 2532 with _DoubleListMixin
3665 // Constructor. 2533 implements Float32List {
3666 _Float32ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length]) 2534 // Constructor.
3667 : super(buffer, _offsetInBytes, 2535 _Float32ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
3668 _defaultIfNull(_length, 2536 : super(
3669 ((buffer.lengthInBytes - _offsetInBytes) ~/ 2537 buffer,
3670 Float32List.BYTES_PER_ELEMENT))) { 2538 _offsetInBytes,
3671 _rangeCheck(buffer.lengthInBytes, 2539 _defaultIfNull(
3672 offsetInBytes, 2540 _length,
3673 length * Float32List.BYTES_PER_ELEMENT); 2541 ((buffer.lengthInBytes - _offsetInBytes) ~/
2542 Float32List.BYTES_PER_ELEMENT))) {
2543 _rangeCheck(buffer.lengthInBytes, offsetInBytes,
2544 length * Float32List.BYTES_PER_ELEMENT);
3674 _offsetAlignmentCheck(_offsetInBytes, Float32List.BYTES_PER_ELEMENT); 2545 _offsetAlignmentCheck(_offsetInBytes, Float32List.BYTES_PER_ELEMENT);
3675 } 2546 }
3676 2547
3677 2548 // Method(s) implementing List interface.
3678 // Method(s) implementing List interface. 2549 double operator [](int index) {
3679 2550 if (index < 0 || index >= length) {
3680 double operator[](int index) { 2551 throw new RangeError.index(index, this, "index");
3681 if (index < 0 || index >= length) { 2552 }
3682 throw new RangeError.index(index, this, "index"); 2553 return _typedData
3683 } 2554 ._getFloat32(offsetInBytes + (index * Float32List.BYTES_PER_ELEMENT));
3684 return _typedData._getFloat32(offsetInBytes + 2555 }
3685 (index * Float32List.BYTES_PER_ELEMENT)); 2556
3686 } 2557 void operator []=(int index, double value) {
3687 2558 if (index < 0 || index >= length) {
3688 void operator[]=(int index, double value) { 2559 throw new RangeError.index(index, this, "index");
3689 if (index < 0 || index >= length) { 2560 }
3690 throw new RangeError.index(index, this, "index"); 2561 _typedData._setFloat32(
3691 } 2562 offsetInBytes + (index * Float32List.BYTES_PER_ELEMENT), value);
3692 _typedData._setFloat32(offsetInBytes + 2563 }
3693 (index * Float32List.BYTES_PER_ELEMENT), value); 2564
3694 } 2565 // Method(s) implementing TypedData interface.
3695
3696
3697 // Method(s) implementing TypedData interface.
3698
3699 int get elementSizeInBytes { 2566 int get elementSizeInBytes {
3700 return Float32List.BYTES_PER_ELEMENT; 2567 return Float32List.BYTES_PER_ELEMENT;
3701 } 2568 }
3702 2569
3703 2570 // Internal utility methods.
3704 // Internal utility methods.
3705
3706 Float32List _createList(int length) { 2571 Float32List _createList(int length) {
3707 return new Float32List(length); 2572 return new Float32List(length);
3708 } 2573 }
3709 } 2574 }
3710 2575
3711 2576 class _Float64ArrayView extends _TypedListView
3712 class _Float64ArrayView extends _TypedListView with _DoubleListMixin implements Float64List { 2577 with _DoubleListMixin
3713 // Constructor. 2578 implements Float64List {
3714 _Float64ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length]) 2579 // Constructor.
3715 : super(buffer, _offsetInBytes, 2580 _Float64ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
3716 _defaultIfNull(_length, 2581 : super(
3717 ((buffer.lengthInBytes - _offsetInBytes) ~/ 2582 buffer,
3718 Float64List.BYTES_PER_ELEMENT))) { 2583 _offsetInBytes,
3719 _rangeCheck(buffer.lengthInBytes, 2584 _defaultIfNull(
3720 offsetInBytes, 2585 _length,
3721 length * Float64List.BYTES_PER_ELEMENT); 2586 ((buffer.lengthInBytes - _offsetInBytes) ~/
2587 Float64List.BYTES_PER_ELEMENT))) {
2588 _rangeCheck(buffer.lengthInBytes, offsetInBytes,
2589 length * Float64List.BYTES_PER_ELEMENT);
3722 _offsetAlignmentCheck(_offsetInBytes, Float64List.BYTES_PER_ELEMENT); 2590 _offsetAlignmentCheck(_offsetInBytes, Float64List.BYTES_PER_ELEMENT);
3723 } 2591 }
3724 2592
3725 2593 // Method(s) implementing List interface.
3726 // Method(s) implementing List interface. 2594 double operator [](int index) {
3727 2595 if (index < 0 || index >= length) {
3728 double operator[](int index) { 2596 throw new RangeError.index(index, this, "index");
3729 if (index < 0 || index >= length) { 2597 }
3730 throw new RangeError.index(index, this, "index"); 2598 return _typedData
3731 } 2599 ._getFloat64(offsetInBytes + (index * Float64List.BYTES_PER_ELEMENT));
3732 return _typedData._getFloat64(offsetInBytes + 2600 }
3733 (index * Float64List.BYTES_PER_ELEMENT)); 2601
3734 } 2602 void operator []=(int index, double value) {
3735 2603 if (index < 0 || index >= length) {
3736 void operator[]=(int index, double value) { 2604 throw new RangeError.index(index, this, "index");
3737 if (index < 0 || index >= length) { 2605 }
3738 throw new RangeError.index(index, this, "index"); 2606 _typedData._setFloat64(
3739 } 2607 offsetInBytes + (index * Float64List.BYTES_PER_ELEMENT), value);
3740 _typedData._setFloat64(offsetInBytes + 2608 }
3741 (index * Float64List.BYTES_PER_ELEMENT), value); 2609
3742 } 2610 // Method(s) implementing TypedData interface.
3743
3744
3745 // Method(s) implementing TypedData interface.
3746
3747 int get elementSizeInBytes { 2611 int get elementSizeInBytes {
3748 return Float64List.BYTES_PER_ELEMENT; 2612 return Float64List.BYTES_PER_ELEMENT;
3749 } 2613 }
3750 2614
3751 2615 // Internal utility methods.
3752 // Internal utility methods.
3753
3754 Float64List _createList(int length) { 2616 Float64List _createList(int length) {
3755 return new Float64List(length); 2617 return new Float64List(length);
3756 } 2618 }
3757 } 2619 }
3758 2620
3759 2621 class _Float32x4ArrayView extends _TypedListView
3760 class _Float32x4ArrayView extends _TypedListView with _Float32x4ListMixin implem ents Float32x4List { 2622 with _Float32x4ListMixin
3761 // Constructor. 2623 implements Float32x4List {
3762 _Float32x4ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length]) 2624 // Constructor.
3763 : super(buffer, _offsetInBytes, 2625 _Float32x4ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
3764 _defaultIfNull(_length, 2626 : super(
3765 ((buffer.lengthInBytes - _offsetInBytes) ~/ 2627 buffer,
3766 Float32x4List.BYTES_PER_ELEMENT))) { 2628 _offsetInBytes,
3767 _rangeCheck(buffer.lengthInBytes, 2629 _defaultIfNull(
3768 offsetInBytes, 2630 _length,
3769 length * Float32x4List.BYTES_PER_ELEMENT); 2631 ((buffer.lengthInBytes - _offsetInBytes) ~/
2632 Float32x4List.BYTES_PER_ELEMENT))) {
2633 _rangeCheck(buffer.lengthInBytes, offsetInBytes,
2634 length * Float32x4List.BYTES_PER_ELEMENT);
3770 _offsetAlignmentCheck(_offsetInBytes, Float32x4List.BYTES_PER_ELEMENT); 2635 _offsetAlignmentCheck(_offsetInBytes, Float32x4List.BYTES_PER_ELEMENT);
3771 } 2636 }
3772 2637
3773 2638 // Method(s) implementing List interface.
3774 // Method(s) implementing List interface. 2639 Float32x4 operator [](int index) {
3775 2640 if (index < 0 || index >= length) {
3776 Float32x4 operator[](int index) { 2641 throw new RangeError.index(index, this, "index");
3777 if (index < 0 || index >= length) { 2642 }
3778 throw new RangeError.index(index, this, "index"); 2643 return _typedData._getFloat32x4(
3779 } 2644 offsetInBytes + (index * Float32x4List.BYTES_PER_ELEMENT));
3780 return _typedData._getFloat32x4(offsetInBytes + 2645 }
3781 (index * Float32x4List.BYTES_PER_ELEMENT)); 2646
3782 } 2647 void operator []=(int index, Float32x4 value) {
3783 2648 if (index < 0 || index >= length) {
3784 void operator[]=(int index, Float32x4 value) { 2649 throw new RangeError.index(index, this, "index");
3785 if (index < 0 || index >= length) { 2650 }
3786 throw new RangeError.index(index, this, "index"); 2651 _typedData._setFloat32x4(
3787 } 2652 offsetInBytes + (index * Float32x4List.BYTES_PER_ELEMENT), value);
3788 _typedData._setFloat32x4(offsetInBytes + 2653 }
3789 (index * Float32x4List.BYTES_PER_ELEMENT), value); 2654
3790 } 2655 // Method(s) implementing TypedData interface.
3791
3792
3793 // Method(s) implementing TypedData interface.
3794
3795 int get elementSizeInBytes { 2656 int get elementSizeInBytes {
3796 return Float32x4List.BYTES_PER_ELEMENT; 2657 return Float32x4List.BYTES_PER_ELEMENT;
3797 } 2658 }
3798 2659
3799 2660 // Internal utility methods.
3800 // Internal utility methods.
3801
3802 Float32x4List _createList(int length) { 2661 Float32x4List _createList(int length) {
3803 return new Float32x4List(length); 2662 return new Float32x4List(length);
3804 } 2663 }
3805 } 2664 }
3806 2665
3807 2666 class _Int32x4ArrayView extends _TypedListView
3808 class _Int32x4ArrayView extends _TypedListView with _Int32x4ListMixin implements Int32x4List { 2667 with _Int32x4ListMixin
3809 // Constructor. 2668 implements Int32x4List {
3810 _Int32x4ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length]) 2669 // Constructor.
3811 : super(buffer, _offsetInBytes, 2670 _Int32x4ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
3812 _defaultIfNull(_length, 2671 : super(
3813 ((buffer.lengthInBytes - _offsetInBytes) ~/ 2672 buffer,
3814 Int32x4List.BYTES_PER_ELEMENT))) { 2673 _offsetInBytes,
3815 _rangeCheck(buffer.lengthInBytes, 2674 _defaultIfNull(
3816 offsetInBytes, 2675 _length,
3817 length * Int32x4List.BYTES_PER_ELEMENT); 2676 ((buffer.lengthInBytes - _offsetInBytes) ~/
2677 Int32x4List.BYTES_PER_ELEMENT))) {
2678 _rangeCheck(buffer.lengthInBytes, offsetInBytes,
2679 length * Int32x4List.BYTES_PER_ELEMENT);
3818 _offsetAlignmentCheck(_offsetInBytes, Int32x4List.BYTES_PER_ELEMENT); 2680 _offsetAlignmentCheck(_offsetInBytes, Int32x4List.BYTES_PER_ELEMENT);
3819 } 2681 }
3820 2682
3821 2683 // Method(s) implementing List interface.
3822 // Method(s) implementing List interface. 2684 Int32x4 operator [](int index) {
3823 2685 if (index < 0 || index >= length) {
3824 Int32x4 operator[](int index) { 2686 throw new RangeError.index(index, this, "index");
3825 if (index < 0 || index >= length) { 2687 }
3826 throw new RangeError.index(index, this, "index"); 2688 return _typedData
3827 } 2689 ._getInt32x4(offsetInBytes + (index * Int32x4List.BYTES_PER_ELEMENT));
3828 return _typedData._getInt32x4(offsetInBytes + 2690 }
3829 (index * Int32x4List.BYTES_PER_ELEMENT)); 2691
3830 } 2692 void operator []=(int index, Int32x4 value) {
3831 2693 if (index < 0 || index >= length) {
3832 void operator[]=(int index, Int32x4 value) { 2694 throw new RangeError.index(index, this, "index");
3833 if (index < 0 || index >= length) { 2695 }
3834 throw new RangeError.index(index, this, "index"); 2696 _typedData._setInt32x4(
3835 } 2697 offsetInBytes + (index * Int32x4List.BYTES_PER_ELEMENT), value);
3836 _typedData._setInt32x4(offsetInBytes + 2698 }
3837 (index * Int32x4List.BYTES_PER_ELEMENT), value); 2699
3838 } 2700 // Method(s) implementing TypedData interface.
3839
3840
3841 // Method(s) implementing TypedData interface.
3842
3843 int get elementSizeInBytes { 2701 int get elementSizeInBytes {
3844 return Int32x4List.BYTES_PER_ELEMENT; 2702 return Int32x4List.BYTES_PER_ELEMENT;
3845 } 2703 }
3846 2704
3847 2705 // Internal utility methods.
3848 // Internal utility methods.
3849
3850 Int32x4List _createList(int length) { 2706 Int32x4List _createList(int length) {
3851 return new Int32x4List(length); 2707 return new Int32x4List(length);
3852 } 2708 }
3853 } 2709 }
3854 2710
3855 2711 class _Float64x2ArrayView extends _TypedListView
3856 class _Float64x2ArrayView extends _TypedListView with _Float64x2ListMixin implem ents Float64x2List { 2712 with _Float64x2ListMixin
3857 // Constructor. 2713 implements Float64x2List {
3858 _Float64x2ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length]) 2714 // Constructor.
3859 : super(buffer, _offsetInBytes, 2715 _Float64x2ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
3860 _defaultIfNull(_length, 2716 : super(
3861 ((buffer.lengthInBytes - _offsetInBytes) ~/ 2717 buffer,
3862 Float64x2List.BYTES_PER_ELEMENT))) { 2718 _offsetInBytes,
3863 _rangeCheck(buffer.lengthInBytes, 2719 _defaultIfNull(
3864 offsetInBytes, 2720 _length,
3865 length * Float64x2List.BYTES_PER_ELEMENT); 2721 ((buffer.lengthInBytes - _offsetInBytes) ~/
2722 Float64x2List.BYTES_PER_ELEMENT))) {
2723 _rangeCheck(buffer.lengthInBytes, offsetInBytes,
2724 length * Float64x2List.BYTES_PER_ELEMENT);
3866 _offsetAlignmentCheck(_offsetInBytes, Float64x2List.BYTES_PER_ELEMENT); 2725 _offsetAlignmentCheck(_offsetInBytes, Float64x2List.BYTES_PER_ELEMENT);
3867 } 2726 }
3868 2727
3869 2728 // Method(s) implementing List interface.
3870 // Method(s) implementing List interface. 2729 Float64x2 operator [](int index) {
3871 2730 if (index < 0 || index >= length) {
3872 Float64x2 operator[](int index) { 2731 throw new RangeError.index(index, this, "index");
3873 if (index < 0 || index >= length) { 2732 }
3874 throw new RangeError.index(index, this, "index"); 2733 return _typedData._getFloat64x2(
3875 } 2734 offsetInBytes + (index * Float64x2List.BYTES_PER_ELEMENT));
3876 return _typedData._getFloat64x2(offsetInBytes + 2735 }
3877 (index * Float64x2List.BYTES_PER_ELEMENT)); 2736
3878 } 2737 void operator []=(int index, Float64x2 value) {
3879 2738 if (index < 0 || index >= length) {
3880 void operator[]=(int index, Float64x2 value) { 2739 throw new RangeError.index(index, this, "index");
3881 if (index < 0 || index >= length) { 2740 }
3882 throw new RangeError.index(index, this, "index"); 2741 _typedData._setFloat64x2(
3883 } 2742 offsetInBytes + (index * Float64x2List.BYTES_PER_ELEMENT), value);
3884 _typedData._setFloat64x2(offsetInBytes + 2743 }
3885 (index * Float64x2List.BYTES_PER_ELEMENT), value); 2744
3886 } 2745 // Method(s) implementing TypedData interface.
3887
3888
3889 // Method(s) implementing TypedData interface.
3890
3891 int get elementSizeInBytes { 2746 int get elementSizeInBytes {
3892 return Float64x2List.BYTES_PER_ELEMENT; 2747 return Float64x2List.BYTES_PER_ELEMENT;
3893 } 2748 }
3894 2749
3895 2750 // Internal utility methods.
3896 // Internal utility methods.
3897
3898 Float64x2List _createList(int length) { 2751 Float64x2List _createList(int length) {
3899 return new Float64x2List(length); 2752 return new Float64x2List(length);
3900 } 2753 }
3901 } 2754 }
3902 2755
3903
3904 class _ByteDataView implements ByteData { 2756 class _ByteDataView implements ByteData {
3905 _ByteDataView(TypedData typedData, int _offsetInBytes, int _lengthInBytes) 2757 _ByteDataView(TypedData typedData, int _offsetInBytes, int _lengthInBytes)
3906 : _typedData = typedData, 2758 : _typedData = typedData,
3907 _offset = _offsetInBytes, 2759 _offset = _offsetInBytes,
3908 length = _lengthInBytes { 2760 length = _lengthInBytes {
3909 _rangeCheck(_typedData.lengthInBytes, _offset, length); 2761 _rangeCheck(_typedData.lengthInBytes, _offset, length);
3910 } 2762 }
3911 2763
3912 2764 // Method(s) implementing TypedData interface.
3913 // Method(s) implementing TypedData interface. 2765 _ByteBuffer get buffer {
3914
3915 ByteBuffer get buffer {
3916 return _typedData.buffer; 2766 return _typedData.buffer;
3917 } 2767 }
3918 2768
3919 int get lengthInBytes { 2769 int get lengthInBytes {
3920 return length; 2770 return length;
3921 } 2771 }
3922 2772
3923 int get offsetInBytes { 2773 int get offsetInBytes {
3924 return _offset; 2774 return _offset;
3925 } 2775 }
3926 2776
3927 int get elementSizeInBytes { 2777 int get elementSizeInBytes {
3928 return 1; 2778 return 1;
3929 } 2779 }
3930 2780
3931 // Method(s) implementing ByteData interface. 2781 // Method(s) implementing ByteData interface.
3932 2782
3933 int getInt8(int byteOffset) { 2783 int getInt8(int byteOffset) {
3934 if (byteOffset < 0 || byteOffset >= length) { 2784 if (byteOffset < 0 || byteOffset >= length) {
3935 throw new RangeError.index(byteOffset, this, "byteOffset"); 2785 throw new RangeError.index(byteOffset, this, "byteOffset");
3936 } 2786 }
3937 return _typedData._getInt8(_offset + byteOffset); 2787 return _typedData._getInt8(_offset + byteOffset);
3938 } 2788 }
2789
3939 void setInt8(int byteOffset, int value) { 2790 void setInt8(int byteOffset, int value) {
3940 if (byteOffset < 0 || byteOffset >= length) { 2791 if (byteOffset < 0 || byteOffset >= length) {
3941 throw new RangeError.index(byteOffset, this, "byteOffset"); 2792 throw new RangeError.index(byteOffset, this, "byteOffset");
3942 } 2793 }
3943 _typedData._setInt8(_offset + byteOffset, value); 2794 _typedData._setInt8(_offset + byteOffset, value);
3944 } 2795 }
3945 2796
3946 int getUint8(int byteOffset) { 2797 int getUint8(int byteOffset) {
3947 if (byteOffset < 0 || byteOffset >= length) { 2798 if (byteOffset < 0 || byteOffset >= length) {
3948 throw new RangeError.index(byteOffset, this, "byteOffset"); 2799 throw new RangeError.index(byteOffset, this, "byteOffset");
3949 } 2800 }
3950 return _typedData._getUint8(_offset + byteOffset); 2801 return _typedData._getUint8(_offset + byteOffset);
3951 } 2802 }
2803
3952 void setUint8(int byteOffset, int value) { 2804 void setUint8(int byteOffset, int value) {
3953 if (byteOffset < 0 || byteOffset >= length) { 2805 if (byteOffset < 0 || byteOffset >= length) {
3954 throw new RangeError.index(byteOffset, this, "byteOffset"); 2806 throw new RangeError.index(byteOffset, this, "byteOffset");
3955 } 2807 }
3956 _typedData._setUint8(_offset + byteOffset, value); 2808 _typedData._setUint8(_offset + byteOffset, value);
3957 } 2809 }
3958 2810
3959 int getInt16(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) { 2811 int getInt16(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
3960 if (byteOffset < 0 || byteOffset + 1 >= length) { 2812 if (byteOffset < 0 || byteOffset + 1 >= length) {
3961 throw new RangeError.range(byteOffset, 0, length - 2, "byteOffset"); 2813 throw new RangeError.range(byteOffset, 0, length - 2, "byteOffset");
3962 } 2814 }
3963 var result = _typedData._getInt16(_offset + byteOffset); 2815 var result = _typedData._getInt16(_offset + byteOffset);
3964 if (identical(endian, Endianness.HOST_ENDIAN)) { 2816 if (identical(endian, Endianness.HOST_ENDIAN)) {
3965 return result; 2817 return result;
3966 } 2818 }
3967 return _byteSwap16(result).toSigned(16); 2819 return _byteSwap16(result).toSigned(16);
3968 } 2820 }
3969 void setInt16(int byteOffset, 2821
3970 int value, 2822 void setInt16(int byteOffset, int value,
3971 [Endianness endian = Endianness.BIG_ENDIAN]) { 2823 [Endianness endian = Endianness.BIG_ENDIAN]) {
3972 if (byteOffset < 0 || byteOffset + 1 >= length) { 2824 if (byteOffset < 0 || byteOffset + 1 >= length) {
3973 throw new RangeError.range(byteOffset, 0, length - 2, "byteOffset"); 2825 throw new RangeError.range(byteOffset, 0, length - 2, "byteOffset");
3974 } 2826 }
3975 _typedData._setInt16(_offset + byteOffset, 2827 _typedData._setInt16(_offset + byteOffset,
3976 identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap16(value)); 2828 identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap16(value));
3977 } 2829 }
3978 2830
3979 int getUint16(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) { 2831 int getUint16(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
3980 if (byteOffset < 0 || byteOffset + 1 >= length) { 2832 if (byteOffset < 0 || byteOffset + 1 >= length) {
3981 throw new RangeError.range(byteOffset, 0, length - 2, "byteOffset"); 2833 throw new RangeError.range(byteOffset, 0, length - 2, "byteOffset");
3982 } 2834 }
3983 var result = _typedData._getUint16(_offset + byteOffset); 2835 var result = _typedData._getUint16(_offset + byteOffset);
3984 if (identical(endian, Endianness.HOST_ENDIAN)) { 2836 if (identical(endian, Endianness.HOST_ENDIAN)) {
3985 return result; 2837 return result;
3986 } 2838 }
3987 return _byteSwap16(result); 2839 return _byteSwap16(result);
3988 } 2840 }
3989 void setUint16(int byteOffset, 2841
3990 int value, 2842 void setUint16(int byteOffset, int value,
3991 [Endianness endian = Endianness.BIG_ENDIAN]) { 2843 [Endianness endian = Endianness.BIG_ENDIAN]) {
3992 if (byteOffset < 0 || byteOffset + 1 >= length) { 2844 if (byteOffset < 0 || byteOffset + 1 >= length) {
3993 throw new RangeError.range(byteOffset, 0, length - 2, "byteOffset"); 2845 throw new RangeError.range(byteOffset, 0, length - 2, "byteOffset");
3994 } 2846 }
3995 _typedData._setUint16(_offset + byteOffset, 2847 _typedData._setUint16(_offset + byteOffset,
3996 identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap16(value)); 2848 identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap16(value));
3997 } 2849 }
3998 2850
3999 int getInt32(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) { 2851 int getInt32(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
4000 if (byteOffset < 0 || byteOffset + 3 >= length) { 2852 if (byteOffset < 0 || byteOffset + 3 >= length) {
4001 throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset"); 2853 throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
4002 } 2854 }
4003 var result = _typedData._getInt32(_offset + byteOffset); 2855 var result = _typedData._getInt32(_offset + byteOffset);
4004 if (identical(endian, Endianness.HOST_ENDIAN)) { 2856 if (identical(endian, Endianness.HOST_ENDIAN)) {
4005 return result; 2857 return result;
4006 } 2858 }
4007 return _byteSwap32(result).toSigned(32); 2859 return _byteSwap32(result).toSigned(32);
4008 } 2860 }
4009 void setInt32(int byteOffset, 2861
4010 int value, 2862 void setInt32(int byteOffset, int value,
4011 [Endianness endian = Endianness.BIG_ENDIAN]) { 2863 [Endianness endian = Endianness.BIG_ENDIAN]) {
4012 if (byteOffset < 0 || byteOffset + 3 >= length) { 2864 if (byteOffset < 0 || byteOffset + 3 >= length) {
4013 throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset"); 2865 throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
4014 } 2866 }
4015 _typedData._setInt32(_offset + byteOffset, 2867 _typedData._setInt32(_offset + byteOffset,
4016 identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap32(value)); 2868 identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap32(value));
4017 } 2869 }
4018 2870
4019 int getUint32(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) { 2871 int getUint32(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
4020 if (byteOffset < 0 || byteOffset + 3 >= length) { 2872 if (byteOffset < 0 || byteOffset + 3 >= length) {
4021 throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset"); 2873 throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
4022 } 2874 }
4023 var result = _typedData._getUint32(_offset + byteOffset); 2875 var result = _typedData._getUint32(_offset + byteOffset);
4024 if (identical(endian, Endianness.HOST_ENDIAN)) { 2876 if (identical(endian, Endianness.HOST_ENDIAN)) {
4025 return result; 2877 return result;
4026 } 2878 }
4027 return _byteSwap32(result); 2879 return _byteSwap32(result);
4028 } 2880 }
4029 void setUint32(int byteOffset, 2881
4030 int value, 2882 void setUint32(int byteOffset, int value,
4031 [Endianness endian = Endianness.BIG_ENDIAN]) { 2883 [Endianness endian = Endianness.BIG_ENDIAN]) {
4032 if (byteOffset < 0 || byteOffset + 3 >= length) { 2884 if (byteOffset < 0 || byteOffset + 3 >= length) {
4033 throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset"); 2885 throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
4034 } 2886 }
4035 _typedData._setUint32(_offset + byteOffset, 2887 _typedData._setUint32(_offset + byteOffset,
4036 identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap32(value)); 2888 identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap32(value));
4037 } 2889 }
4038 2890
4039 int getInt64(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) { 2891 int getInt64(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
4040 if (byteOffset < 0 || byteOffset + 7 >= length) { 2892 if (byteOffset < 0 || byteOffset + 7 >= length) {
4041 throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset"); 2893 throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
4042 } 2894 }
4043 var result = _typedData._getInt64(_offset + byteOffset); 2895 var result = _typedData._getInt64(_offset + byteOffset);
4044 if (identical(endian, Endianness.HOST_ENDIAN)) { 2896 if (identical(endian, Endianness.HOST_ENDIAN)) {
4045 return result; 2897 return result;
4046 } 2898 }
4047 return _byteSwap64(result).toSigned(64); 2899 return _byteSwap64(result).toSigned(64);
4048 } 2900 }
4049 void setInt64(int byteOffset, 2901
4050 int value, 2902 void setInt64(int byteOffset, int value,
4051 [Endianness endian = Endianness.BIG_ENDIAN]) { 2903 [Endianness endian = Endianness.BIG_ENDIAN]) {
4052 if (byteOffset < 0 || byteOffset + 7 >= length) { 2904 if (byteOffset < 0 || byteOffset + 7 >= length) {
4053 throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset"); 2905 throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
4054 } 2906 }
4055 _typedData._setInt64(_offset + byteOffset, 2907 _typedData._setInt64(_offset + byteOffset,
4056 identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap64(value)); 2908 identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap64(value));
4057 } 2909 }
4058 2910
4059 int getUint64(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) { 2911 int getUint64(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
4060 if (byteOffset < 0 || byteOffset + 7 >= length) { 2912 if (byteOffset < 0 || byteOffset + 7 >= length) {
4061 throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset"); 2913 throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
4062 } 2914 }
4063 var result = _typedData._getUint64(_offset + byteOffset); 2915 var result = _typedData._getUint64(_offset + byteOffset);
4064 if (identical(endian, Endianness.HOST_ENDIAN)) { 2916 if (identical(endian, Endianness.HOST_ENDIAN)) {
4065 return result; 2917 return result;
4066 } 2918 }
4067 return _byteSwap64(result); 2919 return _byteSwap64(result);
4068 } 2920 }
4069 void setUint64(int byteOffset, 2921
4070 int value, 2922 void setUint64(int byteOffset, int value,
4071 [Endianness endian = Endianness.BIG_ENDIAN]) { 2923 [Endianness endian = Endianness.BIG_ENDIAN]) {
4072 if (byteOffset < 0 || byteOffset + 7 >= length) { 2924 if (byteOffset < 0 || byteOffset + 7 >= length) {
4073 throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset"); 2925 throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
4074 } 2926 }
4075 _typedData._setUint64(_offset + byteOffset, 2927 _typedData._setUint64(_offset + byteOffset,
4076 identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap64(value)); 2928 identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap64(value));
4077 } 2929 }
4078 2930
4079 double getFloat32(int byteOffset, 2931 double getFloat32(int byteOffset,
4080 [Endianness endian = Endianness.BIG_ENDIAN]) { 2932 [Endianness endian = Endianness.BIG_ENDIAN]) {
4081 if (byteOffset < 0 || byteOffset + 3 >= length) { 2933 if (byteOffset < 0 || byteOffset + 3 >= length) {
4082 throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset"); 2934 throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
4083 } 2935 }
4084 if (identical(endian, Endianness.HOST_ENDIAN)) { 2936 if (identical(endian, Endianness.HOST_ENDIAN)) {
4085 return _typedData._getFloat32(_offset + byteOffset); 2937 return _typedData._getFloat32(_offset + byteOffset);
4086 } 2938 }
4087 _convU32[0] = _byteSwap32(_typedData._getUint32(_offset + byteOffset)); 2939 _convU32[0] = _byteSwap32(_typedData._getUint32(_offset + byteOffset));
4088 return _convF32[0]; 2940 return _convF32[0];
4089 } 2941 }
4090 void setFloat32(int byteOffset, 2942
4091 double value, 2943 void setFloat32(int byteOffset, double value,
4092 [Endianness endian = Endianness.BIG_ENDIAN]) { 2944 [Endianness endian = Endianness.BIG_ENDIAN]) {
4093 if (byteOffset < 0 || byteOffset + 3 >= length) { 2945 if (byteOffset < 0 || byteOffset + 3 >= length) {
4094 throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset"); 2946 throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
4095 } 2947 }
4096 if (identical(endian, Endianness.HOST_ENDIAN)) { 2948 if (identical(endian, Endianness.HOST_ENDIAN)) {
4097 _typedData._setFloat32(_offset + byteOffset, value); 2949 _typedData._setFloat32(_offset + byteOffset, value);
4098 return; 2950 return;
4099 } 2951 }
4100 _convF32[0] = value; 2952 _convF32[0] = value;
4101 _typedData._setUint32(_offset + byteOffset, _byteSwap32(_convU32[0])); 2953 _typedData._setUint32(_offset + byteOffset, _byteSwap32(_convU32[0]));
4102 } 2954 }
4103 2955
4104 double getFloat64(int byteOffset, 2956 double getFloat64(int byteOffset,
4105 [Endianness endian = Endianness.BIG_ENDIAN]) { 2957 [Endianness endian = Endianness.BIG_ENDIAN]) {
4106 if (byteOffset < 0 || byteOffset + 7 >= length) { 2958 if (byteOffset < 0 || byteOffset + 7 >= length) {
4107 throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset"); 2959 throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
4108 } 2960 }
4109 if (identical(endian, Endianness.HOST_ENDIAN)) { 2961 if (identical(endian, Endianness.HOST_ENDIAN)) {
4110 return _typedData._getFloat64(_offset + byteOffset); 2962 return _typedData._getFloat64(_offset + byteOffset);
4111 } 2963 }
4112 _convU64[0] = _byteSwap64(_typedData._getUint64(_offset + byteOffset)); 2964 _convU64[0] = _byteSwap64(_typedData._getUint64(_offset + byteOffset));
4113 return _convF64[0]; 2965 return _convF64[0];
4114 } 2966 }
4115 void setFloat64(int byteOffset, 2967
4116 double value, 2968 void setFloat64(int byteOffset, double value,
4117 [Endianness endian = Endianness.BIG_ENDIAN]) { 2969 [Endianness endian = Endianness.BIG_ENDIAN]) {
4118 if (byteOffset < 0 || byteOffset + 7 >= length) { 2970 if (byteOffset < 0 || byteOffset + 7 >= length) {
4119 throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset"); 2971 throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
4120 } 2972 }
4121 if (identical(endian, Endianness.HOST_ENDIAN)) { 2973 if (identical(endian, Endianness.HOST_ENDIAN)) {
4122 _typedData._setFloat64(_offset + byteOffset, value); 2974 _typedData._setFloat64(_offset + byteOffset, value);
4123 return; 2975 return;
4124 } 2976 }
4125 _convF64[0] = value; 2977 _convF64[0] = value;
4126 _typedData._setUint64(_offset + byteOffset, _byteSwap64(_convU64[0])); 2978 _typedData._setUint64(_offset + byteOffset, _byteSwap64(_convU64[0]));
4127 } 2979 }
4128 2980
4129 Float32x4 getFloat32x4(int byteOffset, 2981 Float32x4 getFloat32x4(int byteOffset,
4130 [Endianness endian = Endianness.BIG_ENDIAN]) { 2982 [Endianness endian = Endianness.BIG_ENDIAN]) {
4131 if (byteOffset < 0 || byteOffset + 3 >= length) { 2983 if (byteOffset < 0 || byteOffset + 3 >= length) {
4132 throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset"); 2984 throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
4133 } 2985 }
4134 // TODO(johnmccutchan) : Need to resolve this for endianity. 2986 // TODO(johnmccutchan) : Need to resolve this for endianity.
4135 return _typedData._getFloat32x4(_offset + byteOffset); 2987 return _typedData._getFloat32x4(_offset + byteOffset);
4136 } 2988 }
4137 void setFloat32x4(int byteOffset, 2989
4138 Float32x4 value, 2990 void setFloat32x4(int byteOffset, Float32x4 value,
4139 [Endianness endian = Endianness.BIG_ENDIAN]) { 2991 [Endianness endian = Endianness.BIG_ENDIAN]) {
4140 if (byteOffset < 0 || byteOffset + 3 >= length) { 2992 if (byteOffset < 0 || byteOffset + 3 >= length) {
4141 throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset"); 2993 throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
4142 } 2994 }
4143 // TODO(johnmccutchan) : Need to resolve this for endianity. 2995 // TODO(johnmccutchan) : Need to resolve this for endianity.
4144 _typedData._setFloat32x4(_offset + byteOffset, value); 2996 _typedData._setFloat32x4(_offset + byteOffset, value);
4145
4146 } 2997 }
4147 2998
4148 final TypedData _typedData; 2999 final TypedData _typedData;
4149 final int _offset; 3000 final int _offset;
4150 final int length; 3001 final int length;
4151 } 3002 }
4152 3003
4153 int _byteSwap16(int value) { 3004 int _byteSwap16(int value) {
4154 return ((value & 0xFF00) >> 8) | 3005 return ((value & 0xFF00) >> 8) | ((value & 0x00FF) << 8);
4155 ((value & 0x00FF) << 8);
4156 } 3006 }
4157 3007
4158 int _byteSwap32(int value) { 3008 int _byteSwap32(int value) {
4159 value = ((value & 0xFF00FF00) >> 8) | ((value & 0x00FF00FF) << 8); 3009 value = ((value & 0xFF00FF00) >> 8) | ((value & 0x00FF00FF) << 8);
4160 value = ((value & 0xFFFF0000) >> 16) | ((value & 0x0000FFFF) << 16); 3010 value = ((value & 0xFFFF0000) >> 16) | ((value & 0x0000FFFF) << 16);
4161 return value; 3011 return value;
4162 } 3012 }
4163 3013
4164 int _byteSwap64(int value) { 3014 int _byteSwap64(int value) {
4165 return (_byteSwap32(value) << 32) | _byteSwap32(value >> 32); 3015 return (_byteSwap32(value) << 32) | _byteSwap32(value >> 32);
4166 } 3016 }
4167 3017
4168 final _convU32 = new Uint32List(2); 3018 final _convU32 = new Uint32List(2);
4169 final _convU64 = new Uint64List.view(_convU32.buffer); 3019 final _convU64 = new Uint64List.view(_convU32.buffer);
4170 final _convF32 = new Float32List.view(_convU32.buffer); 3020 final _convF32 = new Float32List.view(_convU32.buffer);
4171 final _convF64 = new Float64List.view(_convU32.buffer); 3021 final _convF64 = new Float64List.view(_convU32.buffer);
4172 3022
4173 // Top level utility methods. 3023 // Top level utility methods.
4174 int _toInt(int value, int mask) { 3024 int _toInt(int value, int mask) {
4175 value &= mask; 3025 value &= mask;
4176 if (value > (mask >> 1)) value -= mask + 1; 3026 if (value > (mask >> 1)) value -= mask + 1;
4177 return value; 3027 return value;
4178 } 3028 }
4179 3029
4180
4181 int _toInt8(int value) { 3030 int _toInt8(int value) {
4182 return _toInt(value, 0xFF); 3031 return _toInt(value, 0xFF);
4183 } 3032 }
4184 3033
4185
4186 int _toUint8(int value) { 3034 int _toUint8(int value) {
4187 return value & 0xFF; 3035 return value & 0xFF;
4188 } 3036 }
4189 3037
4190
4191 int _toClampedUint8(int value) { 3038 int _toClampedUint8(int value) {
4192 if (value < 0) return 0; 3039 if (value < 0) return 0;
4193 if (value > 0xFF) return 0xFF; 3040 if (value > 0xFF) return 0xFF;
4194 return value; 3041 return value;
4195 } 3042 }
4196 3043
4197
4198 int _toInt16(int value) { 3044 int _toInt16(int value) {
4199 return _toInt(value, 0xFFFF); 3045 return _toInt(value, 0xFFFF);
4200 } 3046 }
4201 3047
4202
4203 int _toUint16(int value) { 3048 int _toUint16(int value) {
4204 return value & 0xFFFF; 3049 return value & 0xFFFF;
4205 } 3050 }
4206 3051
4207
4208 int _toInt32(int value) { 3052 int _toInt32(int value) {
4209 return _toInt(value, 0xFFFFFFFF); 3053 return _toInt(value, 0xFFFFFFFF);
4210 } 3054 }
4211 3055
4212
4213 int _toUint32(int value) { 3056 int _toUint32(int value) {
4214 return value & 0xFFFFFFFF; 3057 return value & 0xFFFFFFFF;
4215 } 3058 }
4216 3059
4217
4218 int _toInt64(int value) { 3060 int _toInt64(int value) {
4219 // Avoid bigint mask when possible. 3061 // Avoid bigint mask when possible.
4220 return (ClassID.getID(value) == ClassID.cidBigint) ? 3062 return (ClassID.getID(value) == ClassID.cidBigint)
4221 _toInt(value, 0xFFFFFFFFFFFFFFFF) : value; 3063 ? _toInt(value, 0xFFFFFFFFFFFFFFFF)
3064 : value;
4222 } 3065 }
4223 3066
4224
4225 int _toUint64(int value) { 3067 int _toUint64(int value) {
4226 // Avoid bigint mask when possible. 3068 // Avoid bigint mask when possible.
4227 return (ClassID.getID(value) == ClassID.cidBigint) ? 3069 return (ClassID.getID(value) == ClassID.cidBigint)
4228 _toInt(value, 0xFFFFFFFFFFFFFFFF) : value; 3070 ? _toInt(value, 0xFFFFFFFFFFFFFFFF)
3071 : value;
4229 } 3072 }
4230 3073
4231
4232 void _rangeCheck(int listLength, int start, int length) { 3074 void _rangeCheck(int listLength, int start, int length) {
4233 if (length < 0) { 3075 if (length < 0) {
4234 throw new RangeError.value(length); 3076 throw new RangeError.value(length);
4235 } 3077 }
4236 if (start < 0) { 3078 if (start < 0) {
4237 throw new RangeError.value(start); 3079 throw new RangeError.value(start);
4238 } 3080 }
4239 if (start + length > listLength) { 3081 if (start + length > listLength) {
4240 throw new RangeError.value(start + length); 3082 throw new RangeError.value(start + length);
4241 } 3083 }
4242 } 3084 }
4243 3085
4244
4245 void _offsetAlignmentCheck(int offset, int alignment) { 3086 void _offsetAlignmentCheck(int offset, int alignment) {
4246 if ((offset % alignment) != 0) { 3087 if ((offset % alignment) != 0) {
4247 throw new RangeError('Offset ($offset) must be a multiple of ' 3088 throw new RangeError('Offset ($offset) must be a multiple of '
4248 'BYTES_PER_ELEMENT ($alignment)'); 3089 'BYTES_PER_ELEMENT ($alignment)');
4249 } 3090 }
4250 } 3091 }
4251 3092
4252
4253 int _defaultIfNull(object, value) { 3093 int _defaultIfNull(object, value) {
4254 if (object == null) { 3094 if (object == null) {
4255 return value; 3095 return value;
4256 } 3096 }
4257 return object; 3097 return object;
4258 } 3098 }
OLDNEW
« no previous file with comments | « runtime/lib/typed_data.dart ('k') | runtime/lib/typed_data_sources.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698