| 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 /** | 5 /** |
| 6 * Specialized integers and floating point numbers, | 6 * Specialized integers and floating point numbers, |
| 7 * with SIMD support and efficient lists. | 7 * with SIMD support and efficient lists. |
| 8 */ | 8 */ |
| 9 library dart.typed_data.implementation; | 9 library dart.typed_data.implementation; |
| 10 | 10 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 ByteBuffer get buffer => _storage.buffer; | 142 ByteBuffer get buffer => _storage.buffer; |
| 143 | 143 |
| 144 int get lengthInBytes => _storage.lengthInBytes; | 144 int get lengthInBytes => _storage.lengthInBytes; |
| 145 | 145 |
| 146 int get offsetInBytes => _storage.offsetInBytes; | 146 int get offsetInBytes => _storage.offsetInBytes; |
| 147 | 147 |
| 148 int get elementSizeInBytes => Float32x4List.BYTES_PER_ELEMENT; | 148 int get elementSizeInBytes => Float32x4List.BYTES_PER_ELEMENT; |
| 149 | 149 |
| 150 void _invalidIndex(int index, int length) { | 150 void _invalidIndex(int index, int length) { |
| 151 if (index < 0 || index >= length) { | 151 if (index < 0 || index >= length) { |
| 152 throw new RangeError.range(index, 0, length); | 152 throw new RangeError.index(index, this); |
| 153 } else { | 153 } else { |
| 154 throw new ArgumentError('Invalid list index $index'); | 154 throw new ArgumentError('Invalid list index $index'); |
| 155 } | 155 } |
| 156 } | 156 } |
| 157 | 157 |
| 158 void _checkIndex(int index, int length) { | 158 void _checkIndex(int index, int length) { |
| 159 if (JS('bool', '(# >>> 0 != #)', index, index) || index >= length) { | 159 if (JS('bool', '(# >>> 0 != #)', index, index) || index >= length) { |
| 160 _invalidIndex(index, length); | 160 _invalidIndex(index, length); |
| 161 } | 161 } |
| 162 } | 162 } |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 ByteBuffer get buffer => _storage.buffer; | 248 ByteBuffer get buffer => _storage.buffer; |
| 249 | 249 |
| 250 int get lengthInBytes => _storage.lengthInBytes; | 250 int get lengthInBytes => _storage.lengthInBytes; |
| 251 | 251 |
| 252 int get offsetInBytes => _storage.offsetInBytes; | 252 int get offsetInBytes => _storage.offsetInBytes; |
| 253 | 253 |
| 254 int get elementSizeInBytes => Int32x4List.BYTES_PER_ELEMENT; | 254 int get elementSizeInBytes => Int32x4List.BYTES_PER_ELEMENT; |
| 255 | 255 |
| 256 void _invalidIndex(int index, int length) { | 256 void _invalidIndex(int index, int length) { |
| 257 if (index < 0 || index >= length) { | 257 if (index < 0 || index >= length) { |
| 258 throw new RangeError.range(index, 0, length); | 258 throw new RangeError.index(index, this); |
| 259 } else { | 259 } else { |
| 260 throw new ArgumentError('Invalid list index $index'); | 260 throw new ArgumentError('Invalid list index $index'); |
| 261 } | 261 } |
| 262 } | 262 } |
| 263 | 263 |
| 264 void _checkIndex(int index, int length) { | 264 void _checkIndex(int index, int length) { |
| 265 if (JS('bool', '(# >>> 0 != #)', index, index) | 265 if (JS('bool', '(# >>> 0 != #)', index, index) |
| 266 || JS('bool', '# >= #', index, length)) { | 266 || JS('bool', '# >= #', index, length)) { |
| 267 _invalidIndex(index, length); | 267 _invalidIndex(index, length); |
| 268 } | 268 } |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 ByteBuffer get buffer => _storage.buffer; | 354 ByteBuffer get buffer => _storage.buffer; |
| 355 | 355 |
| 356 int get lengthInBytes => _storage.lengthInBytes; | 356 int get lengthInBytes => _storage.lengthInBytes; |
| 357 | 357 |
| 358 int get offsetInBytes => _storage.offsetInBytes; | 358 int get offsetInBytes => _storage.offsetInBytes; |
| 359 | 359 |
| 360 int get elementSizeInBytes => Float64x2List.BYTES_PER_ELEMENT; | 360 int get elementSizeInBytes => Float64x2List.BYTES_PER_ELEMENT; |
| 361 | 361 |
| 362 void _invalidIndex(int index, int length) { | 362 void _invalidIndex(int index, int length) { |
| 363 if (index < 0 || index >= length) { | 363 if (index < 0 || index >= length) { |
| 364 throw new RangeError.range(index, 0, length); | 364 throw new RangeError.index(index, this); |
| 365 } else { | 365 } else { |
| 366 throw new ArgumentError('Invalid list index $index'); | 366 throw new ArgumentError('Invalid list index $index'); |
| 367 } | 367 } |
| 368 } | 368 } |
| 369 | 369 |
| 370 void _checkIndex(int index, int length) { | 370 void _checkIndex(int index, int length) { |
| 371 if (JS('bool', '(# >>> 0 != #)', index, index) || index >= length) { | 371 if (JS('bool', '(# >>> 0 != #)', index, index) || index >= length) { |
| 372 _invalidIndex(index, length); | 372 _invalidIndex(index, length); |
| 373 } | 373 } |
| 374 } | 374 } |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 | 431 |
| 432 /** | 432 /** |
| 433 * Returns the number of bytes in the representation of each element in this | 433 * Returns the number of bytes in the representation of each element in this |
| 434 * list. | 434 * list. |
| 435 */ | 435 */ |
| 436 @JSName('BYTES_PER_ELEMENT') | 436 @JSName('BYTES_PER_ELEMENT') |
| 437 final int elementSizeInBytes; | 437 final int elementSizeInBytes; |
| 438 | 438 |
| 439 void _invalidIndex(int index, int length) { | 439 void _invalidIndex(int index, int length) { |
| 440 if (index < 0 || index >= length) { | 440 if (index < 0 || index >= length) { |
| 441 throw new RangeError.range(index, 0, length); | 441 throw new RangeError.index(index, this); |
| 442 } else { | 442 } else { |
| 443 throw new ArgumentError('Invalid list index $index'); | 443 throw new ArgumentError('Invalid list index $index'); |
| 444 } | 444 } |
| 445 } | 445 } |
| 446 | 446 |
| 447 void _checkIndex(int index, int length) { | 447 void _checkIndex(int index, int length) { |
| 448 if (JS('bool', '(# >>> 0) !== #', index, index) || | 448 if (JS('bool', '(# >>> 0) !== #', index, index) || |
| 449 JS('int', '#', index) >= length) { // 'int' guaranteed by above test. | 449 JS('int', '#', index) >= length) { // 'int' guaranteed by above test. |
| 450 _invalidIndex(index, length); | 450 _invalidIndex(index, length); |
| 451 } | 451 } |
| (...skipping 1532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1984 Float64x2 max(Float64x2 other) { | 1984 Float64x2 max(Float64x2 other) { |
| 1985 return new NativeFloat64x2._doubles(x > other.x ? x : other.x, | 1985 return new NativeFloat64x2._doubles(x > other.x ? x : other.x, |
| 1986 y > other.y ? y : other.y); | 1986 y > other.y ? y : other.y); |
| 1987 } | 1987 } |
| 1988 | 1988 |
| 1989 /// Returns the lane-wise square root of [this]. | 1989 /// Returns the lane-wise square root of [this]. |
| 1990 Float64x2 sqrt() { | 1990 Float64x2 sqrt() { |
| 1991 return new NativeFloat64x2._doubles(Math.sqrt(x), Math.sqrt(y)); | 1991 return new NativeFloat64x2._doubles(Math.sqrt(x), Math.sqrt(y)); |
| 1992 } | 1992 } |
| 1993 } | 1993 } |
| OLD | NEW |