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