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 // patch classes for Int8List ..... Float64List and ByteData implementations. | 5 // patch classes for Int8List ..... Float64List and ByteData implementations. |
6 | 6 |
7 patch class Int8List { | 7 patch class Int8List { |
8 /* patch */ factory Int8List(int length) { | 8 /* patch */ factory Int8List(int length) { |
9 return new _Int8Array(length); | 9 return new _Int8Array(length); |
10 } | 10 } |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 return result; | 237 return result; |
238 } | 238 } |
239 | 239 |
240 /* patch */ factory Float32x4List.view(ByteBuffer buffer, | 240 /* patch */ factory Float32x4List.view(ByteBuffer buffer, |
241 [int offsetInBytes = 0, int length]) { | 241 [int offsetInBytes = 0, int length]) { |
242 return new _Float32x4ArrayView(buffer, offsetInBytes, length); | 242 return new _Float32x4ArrayView(buffer, offsetInBytes, length); |
243 } | 243 } |
244 } | 244 } |
245 | 245 |
246 | 246 |
247 patch class Uint32x4List { | 247 patch class Int32x4List { |
248 /* patch */ factory Uint32x4List(int length) { | 248 /* patch */ factory Int32x4List(int length) { |
249 return new _Uint32x4Array(length); | 249 return new _Int32x4Array(length); |
250 } | 250 } |
251 | 251 |
252 /* patch */ factory Uint32x4List.fromList(List<Uint32x4> elements) { | 252 /* patch */ factory Int32x4List.fromList(List<Int32x4> elements) { |
253 var result = new _Uint32x4Array(elements.length); | 253 var result = new _Int32x4Array(elements.length); |
254 for (int i = 0; i < elements.length; i++) { | 254 for (int i = 0; i < elements.length; i++) { |
255 result[i] = elements[i]; | 255 result[i] = elements[i]; |
256 } | 256 } |
257 return result; | 257 return result; |
258 } | 258 } |
259 | 259 |
260 /* patch */ factory Uint32x4List.view(ByteBuffer buffer, | 260 /* patch */ factory Int32x4List.view(ByteBuffer buffer, |
261 [int offsetInBytes = 0, int length]) { | 261 [int offsetInBytes = 0, int length]) { |
262 return new _Uint32x4ArrayView(buffer, offsetInBytes, length); | 262 return new _Int32x4ArrayView(buffer, offsetInBytes, length); |
263 } | 263 } |
264 } | 264 } |
265 | 265 |
266 | 266 |
267 patch class Float32x4 { | 267 patch class Float32x4 { |
268 /* patch */ factory Float32x4(double x, double y, double z, double w) { | 268 /* patch */ factory Float32x4(double x, double y, double z, double w) { |
269 return new _Float32x4(x, y, z, w); | 269 return new _Float32x4(x, y, z, w); |
270 } | 270 } |
271 /* patch */ factory Float32x4.splat(double v) { | 271 /* patch */ factory Float32x4.splat(double v) { |
272 return new _Float32x4.splat(v); | 272 return new _Float32x4.splat(v); |
273 } | 273 } |
274 /* patch */ factory Float32x4.zero() { | 274 /* patch */ factory Float32x4.zero() { |
275 return new _Float32x4.zero(); | 275 return new _Float32x4.zero(); |
276 } | 276 } |
277 /* patch */ factory Float32x4.fromUint32x4Bits(Uint32x4 x) { | 277 /* patch */ factory Float32x4.fromInt32x4Bits(Int32x4 x) { |
278 return new _Float32x4.fromUint32x4Bits(x); | 278 return new _Float32x4.fromInt32x4Bits(x); |
279 } | 279 } |
280 } | 280 } |
281 | 281 |
282 | 282 |
283 patch class Uint32x4 { | 283 patch class Int32x4 { |
284 /* patch */ factory Uint32x4(int x, int y, int z, int w) { | 284 /* patch */ factory Int32x4(int x, int y, int z, int w) { |
285 return new _Uint32x4(x, y, z, w); | 285 return new _Int32x4(x, y, z, w); |
286 } | 286 } |
287 /* patch */ factory Uint32x4.bool(bool x, bool y, bool z, bool w) { | 287 /* patch */ factory Int32x4.bool(bool x, bool y, bool z, bool w) { |
288 return new _Uint32x4.bool(x, y, z, w); | 288 return new _Int32x4.bool(x, y, z, w); |
289 } | 289 } |
290 /* patch */ factory Uint32x4.fromFloat32x4Bits(Float32x4 x) { | 290 /* patch */ factory Int32x4.fromFloat32x4Bits(Float32x4 x) { |
291 return new _Uint32x4.fromFloat32x4Bits(x); | 291 return new _Int32x4.fromFloat32x4Bits(x); |
292 } | 292 } |
293 } | 293 } |
294 | 294 |
295 | 295 |
296 patch class ByteData { | 296 patch class ByteData { |
297 /* patch */ factory ByteData(int length) { | 297 /* patch */ factory ByteData(int length) { |
298 var list = new _Uint8Array(length); | 298 var list = new _Uint8Array(length); |
299 return new _ByteDataView(list.buffer, 0, length); | 299 return new _ByteDataView(list.buffer, 0, length); |
300 } | 300 } |
301 | 301 |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 | 504 |
505 Set toSet() { | 505 Set toSet() { |
506 return new Set.from(this); | 506 return new Set.from(this); |
507 } | 507 } |
508 | 508 |
509 Map<int, num> asMap() { | 509 Map<int, num> asMap() { |
510 return IterableMixinWorkaround.asMapList(this); | 510 return IterableMixinWorkaround.asMapList(this); |
511 } | 511 } |
512 | 512 |
513 List sublist(int start, [int end]) { | 513 List sublist(int start, [int end]) { |
514 if (end == null) end = length; | 514 if (end == null) end = this.length; |
515 int length = end - start; | 515 int length = end - start; |
516 _rangeCheck(this.length, start, length); | 516 _rangeCheck(this.length, start, length); |
517 List result = _createList(length); | 517 List result = _createList(length); |
518 result.setRange(0, length, this, start); | 518 result.setRange(0, length, this, start); |
519 return result; | 519 return result; |
520 } | 520 } |
521 | 521 |
522 Iterable getRange(int start, [int end]) { | 522 Iterable getRange(int start, [int end]) { |
523 return IterableMixinWorkaround.getRangeList(this, start, end); | 523 return IterableMixinWorkaround.getRangeList(this, start, end); |
524 } | 524 } |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 native "TypedData_SetFloat32"; | 604 native "TypedData_SetFloat32"; |
605 | 605 |
606 double _getFloat64(int offsetInBytes) native "TypedData_GetFloat64"; | 606 double _getFloat64(int offsetInBytes) native "TypedData_GetFloat64"; |
607 void _setFloat64(int offsetInBytes, double value) | 607 void _setFloat64(int offsetInBytes, double value) |
608 native "TypedData_SetFloat64"; | 608 native "TypedData_SetFloat64"; |
609 | 609 |
610 Float32x4 _getFloat32x4(int offsetInBytes) native "TypedData_GetFloat32x4"; | 610 Float32x4 _getFloat32x4(int offsetInBytes) native "TypedData_GetFloat32x4"; |
611 void _setFloat32x4(int offsetInBytes, Float32x4 value) | 611 void _setFloat32x4(int offsetInBytes, Float32x4 value) |
612 native "TypedData_SetFloat32x4"; | 612 native "TypedData_SetFloat32x4"; |
613 | 613 |
614 Uint32x4 _getUint32x4(int offsetInBytes) native "TypedData_GetUint32x4"; | 614 Int32x4 _getInt32x4(int offsetInBytes) native "TypedData_GetInt32x4"; |
615 void _setUint32x4(int offsetInBytes, Uint32x4 value) | 615 void _setInt32x4(int offsetInBytes, Int32x4 value) |
616 native "TypedData_SetUint32x4"; | 616 native "TypedData_SetInt32x4"; |
617 } | 617 } |
618 | 618 |
619 | 619 |
620 class _Int8Array extends _TypedList implements Int8List { | 620 class _Int8Array extends _TypedList implements Int8List { |
621 // Factory constructors. | 621 // Factory constructors. |
622 | 622 |
623 factory _Int8Array(int length) { | 623 factory _Int8Array(int length) { |
624 return _new(length); | 624 return _new(length); |
625 } | 625 } |
626 | 626 |
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1335 } | 1335 } |
1336 | 1336 |
1337 void _setIndexedFloat32x4(int index, Float32x4 value) { | 1337 void _setIndexedFloat32x4(int index, Float32x4 value) { |
1338 _setFloat32x4(index * Float32x4List.BYTES_PER_ELEMENT, value); | 1338 _setFloat32x4(index * Float32x4List.BYTES_PER_ELEMENT, value); |
1339 } | 1339 } |
1340 | 1340 |
1341 static _Float32x4Array _new(int length) native "TypedData_Float32x4Array_new"; | 1341 static _Float32x4Array _new(int length) native "TypedData_Float32x4Array_new"; |
1342 } | 1342 } |
1343 | 1343 |
1344 | 1344 |
1345 class _Uint32x4Array extends _TypedList implements Uint32x4List { | 1345 class _Int32x4Array extends _TypedList implements Int32x4List { |
1346 // Factory constructors. | 1346 // Factory constructors. |
1347 | 1347 |
1348 factory _Uint32x4Array(int length) { | 1348 factory _Int32x4Array(int length) { |
1349 return _new(length); | 1349 return _new(length); |
1350 } | 1350 } |
1351 | 1351 |
1352 factory _Uint32x4Array.view(ByteBuffer buffer, | 1352 factory _Int32x4Array.view(ByteBuffer buffer, |
1353 [int offsetInBytes = 0, int length]) { | 1353 [int offsetInBytes = 0, int length]) { |
1354 if (length == null) { | 1354 if (length == null) { |
1355 length = (buffer.lengthInBytes - offsetInBytes) ~/ | 1355 length = (buffer.lengthInBytes - offsetInBytes) ~/ |
1356 Uint32x4List.BYTES_PER_ELEMENT; | 1356 Int32x4List.BYTES_PER_ELEMENT; |
1357 } | 1357 } |
1358 return new _Uint32x4ArrayView(buffer, offsetInBytes, length); | 1358 return new _Int32x4ArrayView(buffer, offsetInBytes, length); |
1359 } | 1359 } |
1360 | 1360 |
1361 | 1361 |
1362 Uint32x4 operator[](int index) { | 1362 Int32x4 operator[](int index) { |
1363 if (index < 0 || index >= length) { | 1363 if (index < 0 || index >= length) { |
1364 _throwRangeError(index, length); | 1364 _throwRangeError(index, length); |
1365 } | 1365 } |
1366 return _getIndexedUint32x4(index); | 1366 return _getIndexedInt32x4(index); |
1367 } | 1367 } |
1368 | 1368 |
1369 void operator[]=(int index, Uint32x4 value) { | 1369 void operator[]=(int index, Int32x4 value) { |
1370 if (index < 0 || index >= length) { | 1370 if (index < 0 || index >= length) { |
1371 _throwRangeError(index, length); | 1371 _throwRangeError(index, length); |
1372 } | 1372 } |
1373 _setIndexedUint32x4(index, value); | 1373 _setIndexedInt32x4(index, value); |
1374 } | 1374 } |
1375 | 1375 |
1376 Iterator<Uint32x4> get iterator { | 1376 Iterator<Int32x4> get iterator { |
1377 return new _TypedListIterator<Uint32x4>(this); | 1377 return new _TypedListIterator<Int32x4>(this); |
1378 } | 1378 } |
1379 | 1379 |
1380 | 1380 |
1381 // Method(s) implementing the TypedData interface. | 1381 // Method(s) implementing the TypedData interface. |
1382 | 1382 |
1383 int get elementSizeInBytes { | 1383 int get elementSizeInBytes { |
1384 return Uint32x4List.BYTES_PER_ELEMENT; | 1384 return Int32x4List.BYTES_PER_ELEMENT; |
1385 } | 1385 } |
1386 | 1386 |
1387 | 1387 |
1388 // Internal utility methods. | 1388 // Internal utility methods. |
1389 | 1389 |
1390 _Uint32x4Array _createList(int length) { | 1390 _Int32x4Array _createList(int length) { |
1391 return _new(length); | 1391 return _new(length); |
1392 } | 1392 } |
1393 | 1393 |
1394 Uint32x4 _getIndexedUint32x4(int index) { | 1394 Int32x4 _getIndexedInt32x4(int index) { |
1395 return _getUint32x4(index * Uint32x4List.BYTES_PER_ELEMENT); | 1395 return _getInt32x4(index * Int32x4List.BYTES_PER_ELEMENT); |
1396 } | 1396 } |
1397 | 1397 |
1398 void _setIndexedUint32x4(int index, Uint32x4 value) { | 1398 void _setIndexedInt32x4(int index, Int32x4 value) { |
1399 _setUint32x4(index * Uint32x4List.BYTES_PER_ELEMENT, value); | 1399 _setInt32x4(index * Int32x4List.BYTES_PER_ELEMENT, value); |
1400 } | 1400 } |
1401 | 1401 |
1402 static _Uint32x4Array _new(int length) native "TypedData_Uint32x4Array_new"; | 1402 static _Int32x4Array _new(int length) native "TypedData_Int32x4Array_new"; |
1403 } | 1403 } |
1404 | 1404 |
1405 | 1405 |
1406 class _ExternalInt8Array extends _TypedList implements Int8List { | 1406 class _ExternalInt8Array extends _TypedList implements Int8List { |
1407 // Factory constructors. | 1407 // Factory constructors. |
1408 | 1408 |
1409 factory _ExternalInt8Array(int length) { | 1409 factory _ExternalInt8Array(int length) { |
1410 return _new(length); | 1410 return _new(length); |
1411 } | 1411 } |
1412 | 1412 |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2031 | 2031 |
2032 void _setIndexedFloat32x4(int index, Float32x4 value) { | 2032 void _setIndexedFloat32x4(int index, Float32x4 value) { |
2033 _setFloat32x4(index * Float32x4List.BYTES_PER_ELEMENT, value); | 2033 _setFloat32x4(index * Float32x4List.BYTES_PER_ELEMENT, value); |
2034 } | 2034 } |
2035 | 2035 |
2036 static _ExternalFloat32x4Array _new(int length) native | 2036 static _ExternalFloat32x4Array _new(int length) native |
2037 "ExternalTypedData_Float32x4Array_new"; | 2037 "ExternalTypedData_Float32x4Array_new"; |
2038 } | 2038 } |
2039 | 2039 |
2040 | 2040 |
2041 class _ExternalUint32x4Array extends _TypedList implements Uint32x4List { | 2041 class _ExternalInt32x4Array extends _TypedList implements Int32x4List { |
2042 // Factory constructors. | 2042 // Factory constructors. |
2043 | 2043 |
2044 factory _ExternalUint32x4Array(int length) { | 2044 factory _ExternalInt32x4Array(int length) { |
2045 return _new(length); | 2045 return _new(length); |
2046 } | 2046 } |
2047 | 2047 |
2048 | 2048 |
2049 // Method(s) implementing the List interface. | 2049 // Method(s) implementing the List interface. |
2050 | 2050 |
2051 Uint32x4 operator[](int index) { | 2051 Int32x4 operator[](int index) { |
2052 if (index < 0 || index >= length) { | 2052 if (index < 0 || index >= length) { |
2053 _throwRangeError(index, length); | 2053 _throwRangeError(index, length); |
2054 } | 2054 } |
2055 return _getIndexedUint32x4(index); | 2055 return _getIndexedInt32x4(index); |
2056 } | 2056 } |
2057 | 2057 |
2058 void operator[]=(int index, Uint32x4 value) { | 2058 void operator[]=(int index, Int32x4 value) { |
2059 if (index < 0 || index >= length) { | 2059 if (index < 0 || index >= length) { |
2060 _throwRangeError(index, length); | 2060 _throwRangeError(index, length); |
2061 } | 2061 } |
2062 _setIndexedUint32x4(index, value); | 2062 _setIndexedInt32x4(index, value); |
2063 } | 2063 } |
2064 | 2064 |
2065 Iterator<Uint32x4> get iterator { | 2065 Iterator<Int32x4> get iterator { |
2066 return new _TypedListIterator<Uint32x4>(this); | 2066 return new _TypedListIterator<Int32x4>(this); |
2067 } | 2067 } |
2068 | 2068 |
2069 | 2069 |
2070 // Method(s) implementing the TypedData interface. | 2070 // Method(s) implementing the TypedData interface. |
2071 | 2071 |
2072 int get elementSizeInBytes { | 2072 int get elementSizeInBytes { |
2073 return Uint32x4List.BYTES_PER_ELEMENT; | 2073 return Int32x4List.BYTES_PER_ELEMENT; |
2074 } | 2074 } |
2075 | 2075 |
2076 | 2076 |
2077 // Internal utility methods. | 2077 // Internal utility methods. |
2078 | 2078 |
2079 Uint32x4List _createList(int length) { | 2079 Int32x4List _createList(int length) { |
2080 return new Uint32x4List(length); | 2080 return new Int32x4List(length); |
2081 } | 2081 } |
2082 | 2082 |
2083 Uint32x4 _getIndexedUint32x4(int index) { | 2083 Int32x4 _getIndexedInt32x4(int index) { |
2084 return _getUint32x4(index * Uint32x4List.BYTES_PER_ELEMENT); | 2084 return _getInt32x4(index * Int32x4List.BYTES_PER_ELEMENT); |
2085 } | 2085 } |
2086 | 2086 |
2087 void _setIndexedUint32x4(int index, Uint32x4 value) { | 2087 void _setIndexedInt32x4(int index, Int32x4 value) { |
2088 _setUint32x4(index * Uint32x4List.BYTES_PER_ELEMENT, value); | 2088 _setInt32x4(index * Int32x4List.BYTES_PER_ELEMENT, value); |
2089 } | 2089 } |
2090 | 2090 |
2091 static _ExternalUint32x4Array _new(int length) native | 2091 static _ExternalInt32x4Array _new(int length) native |
2092 "ExternalTypedData_Uint32x4Array_new"; | 2092 "ExternalTypedData_Int32x4Array_new"; |
2093 } | 2093 } |
2094 | 2094 |
2095 | 2095 |
2096 class _Float32x4 implements Float32x4 { | 2096 class _Float32x4 implements Float32x4 { |
2097 factory _Float32x4(double x, double y, double z, double w) | 2097 factory _Float32x4(double x, double y, double z, double w) |
2098 native "Float32x4_fromDoubles"; | 2098 native "Float32x4_fromDoubles"; |
2099 factory _Float32x4.splat(double v) native "Float32x4_splat"; | 2099 factory _Float32x4.splat(double v) native "Float32x4_splat"; |
2100 factory _Float32x4.zero() native "Float32x4_zero"; | 2100 factory _Float32x4.zero() native "Float32x4_zero"; |
2101 factory _Float32x4.fromUint32x4Bits(Uint32x4 x) | 2101 factory _Float32x4.fromInt32x4Bits(Int32x4 x) |
2102 native "Float32x4_fromUint32x4Bits"; | 2102 native "Float32x4_fromInt32x4Bits"; |
2103 Float32x4 operator +(Float32x4 other) { | 2103 Float32x4 operator +(Float32x4 other) { |
2104 return _add(other); | 2104 return _add(other); |
2105 } | 2105 } |
2106 Float32x4 _add(Float32x4 other) native "Float32x4_add"; | 2106 Float32x4 _add(Float32x4 other) native "Float32x4_add"; |
2107 Float32x4 operator -() { | 2107 Float32x4 operator -() { |
2108 return _negate(); | 2108 return _negate(); |
2109 } | 2109 } |
2110 Float32x4 _negate() native "Float32x4_negate"; | 2110 Float32x4 _negate() native "Float32x4_negate"; |
2111 Float32x4 operator -(Float32x4 other) { | 2111 Float32x4 operator -(Float32x4 other) { |
2112 return _sub(other); | 2112 return _sub(other); |
2113 } | 2113 } |
2114 Float32x4 _sub(Float32x4 other) native "Float32x4_sub"; | 2114 Float32x4 _sub(Float32x4 other) native "Float32x4_sub"; |
2115 Float32x4 operator *(Float32x4 other) { | 2115 Float32x4 operator *(Float32x4 other) { |
2116 return _mul(other); | 2116 return _mul(other); |
2117 } | 2117 } |
2118 Float32x4 _mul(Float32x4 other) native "Float32x4_mul"; | 2118 Float32x4 _mul(Float32x4 other) native "Float32x4_mul"; |
2119 Float32x4 operator /(Float32x4 other) { | 2119 Float32x4 operator /(Float32x4 other) { |
2120 return _div(other); | 2120 return _div(other); |
2121 } | 2121 } |
2122 Float32x4 _div(Float32x4 other) native "Float32x4_div"; | 2122 Float32x4 _div(Float32x4 other) native "Float32x4_div"; |
2123 Uint32x4 lessThan(Float32x4 other) { | 2123 Int32x4 lessThan(Float32x4 other) { |
2124 return _cmplt(other); | 2124 return _cmplt(other); |
2125 } | 2125 } |
2126 Uint32x4 _cmplt(Float32x4 other) native "Float32x4_cmplt"; | 2126 Int32x4 _cmplt(Float32x4 other) native "Float32x4_cmplt"; |
2127 Uint32x4 lessThanOrEqual(Float32x4 other) { | 2127 Int32x4 lessThanOrEqual(Float32x4 other) { |
2128 return _cmplte(other); | 2128 return _cmplte(other); |
2129 } | 2129 } |
2130 Uint32x4 _cmplte(Float32x4 other) native "Float32x4_cmplte"; | 2130 Int32x4 _cmplte(Float32x4 other) native "Float32x4_cmplte"; |
2131 Uint32x4 greaterThan(Float32x4 other) { | 2131 Int32x4 greaterThan(Float32x4 other) { |
2132 return _cmpgt(other); | 2132 return _cmpgt(other); |
2133 } | 2133 } |
2134 Uint32x4 _cmpgt(Float32x4 other) native "Float32x4_cmpgt"; | 2134 Int32x4 _cmpgt(Float32x4 other) native "Float32x4_cmpgt"; |
2135 Uint32x4 greaterThanOrEqual(Float32x4 other) { | 2135 Int32x4 greaterThanOrEqual(Float32x4 other) { |
2136 return _cmpgte(other); | 2136 return _cmpgte(other); |
2137 } | 2137 } |
2138 Uint32x4 _cmpgte(Float32x4 other) native "Float32x4_cmpgte"; | 2138 Int32x4 _cmpgte(Float32x4 other) native "Float32x4_cmpgte"; |
2139 Uint32x4 equal(Float32x4 other) { | 2139 Int32x4 equal(Float32x4 other) { |
2140 return _cmpequal(other); | 2140 return _cmpequal(other); |
2141 } | 2141 } |
2142 Uint32x4 _cmpequal(Float32x4 other) | 2142 Int32x4 _cmpequal(Float32x4 other) |
2143 native "Float32x4_cmpequal"; | 2143 native "Float32x4_cmpequal"; |
2144 Uint32x4 notEqual(Float32x4 other) { | 2144 Int32x4 notEqual(Float32x4 other) { |
2145 return _cmpnequal(other); | 2145 return _cmpnequal(other); |
2146 } | 2146 } |
2147 Uint32x4 _cmpnequal(Float32x4 other) | 2147 Int32x4 _cmpnequal(Float32x4 other) |
2148 native "Float32x4_cmpnequal"; | 2148 native "Float32x4_cmpnequal"; |
2149 Float32x4 scale(double s) { | 2149 Float32x4 scale(double s) { |
2150 return _scale(s); | 2150 return _scale(s); |
2151 } | 2151 } |
2152 Float32x4 _scale(double s) native "Float32x4_scale"; | 2152 Float32x4 _scale(double s) native "Float32x4_scale"; |
2153 Float32x4 abs() { | 2153 Float32x4 abs() { |
2154 return _abs(); | 2154 return _abs(); |
2155 } | 2155 } |
2156 Float32x4 _abs() native "Float32x4_abs"; | 2156 Float32x4 _abs() native "Float32x4_abs"; |
2157 Float32x4 clamp(Float32x4 lowerLimit, | 2157 Float32x4 clamp(Float32x4 lowerLimit, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2190 return _reciprocal(); | 2190 return _reciprocal(); |
2191 } | 2191 } |
2192 Float32x4 _reciprocal() native "Float32x4_reciprocal"; | 2192 Float32x4 _reciprocal() native "Float32x4_reciprocal"; |
2193 Float32x4 reciprocalSqrt() { | 2193 Float32x4 reciprocalSqrt() { |
2194 return _reciprocalSqrt(); | 2194 return _reciprocalSqrt(); |
2195 } | 2195 } |
2196 Float32x4 _reciprocalSqrt() native "Float32x4_reciprocalSqrt"; | 2196 Float32x4 _reciprocalSqrt() native "Float32x4_reciprocalSqrt"; |
2197 } | 2197 } |
2198 | 2198 |
2199 | 2199 |
2200 class _Uint32x4 implements Uint32x4 { | 2200 class _Int32x4 implements Int32x4 { |
2201 factory _Uint32x4(int x, int y, int z, int w) | 2201 factory _Int32x4(int x, int y, int z, int w) |
2202 native "Uint32x4_fromInts"; | 2202 native "Int32x4_fromInts"; |
2203 factory _Uint32x4.bool(bool x, bool y, bool z, bool w) | 2203 factory _Int32x4.bool(bool x, bool y, bool z, bool w) |
2204 native "Uint32x4_fromBools"; | 2204 native "Int32x4_fromBools"; |
2205 factory _Uint32x4.fromFloat32x4Bits(Float32x4 x) | 2205 factory _Int32x4.fromFloat32x4Bits(Float32x4 x) |
2206 native "Uint32x4_fromFloat32x4Bits"; | 2206 native "Int32x4_fromFloat32x4Bits"; |
2207 Uint32x4 operator |(Uint32x4 other) { | 2207 Int32x4 operator |(Int32x4 other) { |
2208 return _or(other); | 2208 return _or(other); |
2209 } | 2209 } |
2210 Uint32x4 _or(Uint32x4 other) native "Uint32x4_or"; | 2210 Int32x4 _or(Int32x4 other) native "Int32x4_or"; |
2211 Uint32x4 operator &(Uint32x4 other) { | 2211 Int32x4 operator &(Int32x4 other) { |
2212 return _and(other); | 2212 return _and(other); |
2213 } | 2213 } |
2214 Uint32x4 _and(Uint32x4 other) native "Uint32x4_and"; | 2214 Int32x4 _and(Int32x4 other) native "Int32x4_and"; |
2215 Uint32x4 operator ^(Uint32x4 other) { | 2215 Int32x4 operator ^(Int32x4 other) { |
2216 return _xor(other); | 2216 return _xor(other); |
2217 } | 2217 } |
2218 Uint32x4 _xor(Uint32x4 other) native "Uint32x4_xor"; | 2218 Int32x4 _xor(Int32x4 other) native "Int32x4_xor"; |
2219 Uint32x4 operator +(Uint32x4 other) { | 2219 Int32x4 operator +(Int32x4 other) { |
2220 return _add(other); | 2220 return _add(other); |
2221 } | 2221 } |
2222 Uint32x4 _add(Uint32x4 other) native "Uint32x4_add"; | 2222 Int32x4 _add(Int32x4 other) native "Int32x4_add"; |
2223 Uint32x4 operator -(Uint32x4 other) { | 2223 Int32x4 operator -(Int32x4 other) { |
2224 return _sub(other); | 2224 return _sub(other); |
2225 } | 2225 } |
2226 Uint32x4 _sub(Uint32x4 other) native "Uint32x4_sub"; | 2226 Int32x4 _sub(Int32x4 other) native "Int32x4_sub"; |
2227 int get x native "Uint32x4_getX"; | 2227 int get x native "Int32x4_getX"; |
2228 int get y native "Uint32x4_getY"; | 2228 int get y native "Int32x4_getY"; |
2229 int get z native "Uint32x4_getZ"; | 2229 int get z native "Int32x4_getZ"; |
2230 int get w native "Uint32x4_getW"; | 2230 int get w native "Int32x4_getW"; |
2231 int get signMask native "Uint32x4_getSignMask"; | 2231 int get signMask native "Int32x4_getSignMask"; |
2232 Uint32x4 shuffle(int mask) native "Uint32x4_shuffle"; | 2232 Int32x4 shuffle(int mask) native "Int32x4_shuffle"; |
2233 Uint32x4 shuffleMix(Uint32x4 zw, int mask) native "Uint32x4_shuffleMix"; | 2233 Int32x4 shuffleMix(Int32x4 zw, int mask) native "Int32x4_shuffleMix"; |
2234 Uint32x4 withX(int x) native "Uint32x4_setX"; | 2234 Int32x4 withX(int x) native "Int32x4_setX"; |
2235 Uint32x4 withY(int y) native "Uint32x4_setY"; | 2235 Int32x4 withY(int y) native "Int32x4_setY"; |
2236 Uint32x4 withZ(int z) native "Uint32x4_setZ"; | 2236 Int32x4 withZ(int z) native "Int32x4_setZ"; |
2237 Uint32x4 withW(int w) native "Uint32x4_setW"; | 2237 Int32x4 withW(int w) native "Int32x4_setW"; |
2238 bool get flagX native "Uint32x4_getFlagX"; | 2238 bool get flagX native "Int32x4_getFlagX"; |
2239 bool get flagY native "Uint32x4_getFlagY"; | 2239 bool get flagY native "Int32x4_getFlagY"; |
2240 bool get flagZ native "Uint32x4_getFlagZ"; | 2240 bool get flagZ native "Int32x4_getFlagZ"; |
2241 bool get flagW native "Uint32x4_getFlagW"; | 2241 bool get flagW native "Int32x4_getFlagW"; |
2242 Uint32x4 withFlagX(bool x) native "Uint32x4_setFlagX"; | 2242 Int32x4 withFlagX(bool x) native "Int32x4_setFlagX"; |
2243 Uint32x4 withFlagY(bool y) native "Uint32x4_setFlagY"; | 2243 Int32x4 withFlagY(bool y) native "Int32x4_setFlagY"; |
2244 Uint32x4 withFlagZ(bool z) native "Uint32x4_setFlagZ"; | 2244 Int32x4 withFlagZ(bool z) native "Int32x4_setFlagZ"; |
2245 Uint32x4 withFlagW(bool w) native "Uint32x4_setFlagW"; | 2245 Int32x4 withFlagW(bool w) native "Int32x4_setFlagW"; |
2246 Float32x4 select(Float32x4 trueValue, | 2246 Float32x4 select(Float32x4 trueValue, |
2247 Float32x4 falseValue) { | 2247 Float32x4 falseValue) { |
2248 return _select(trueValue, falseValue); | 2248 return _select(trueValue, falseValue); |
2249 } | 2249 } |
2250 Float32x4 _select(Float32x4 trueValue, | 2250 Float32x4 _select(Float32x4 trueValue, |
2251 Float32x4 falseValue) | 2251 Float32x4 falseValue) |
2252 native "Uint32x4_select"; | 2252 native "Int32x4_select"; |
2253 } | 2253 } |
2254 | 2254 |
2255 class _TypedListIterator<E> implements Iterator<E> { | 2255 class _TypedListIterator<E> implements Iterator<E> { |
2256 final List<E> _array; | 2256 final List<E> _array; |
2257 final int _length; | 2257 final int _length; |
2258 int _position; | 2258 int _position; |
2259 E _current; | 2259 E _current; |
2260 | 2260 |
2261 _TypedListIterator(List array) | 2261 _TypedListIterator(List array) |
2262 : _array = array, _length = array.length, _position = -1 { | 2262 : _array = array, _length = array.length, _position = -1 { |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2918 | 2918 |
2919 | 2919 |
2920 // Internal utility methods. | 2920 // Internal utility methods. |
2921 | 2921 |
2922 Float32x4List _createList(int length) { | 2922 Float32x4List _createList(int length) { |
2923 return new Float32x4List(length); | 2923 return new Float32x4List(length); |
2924 } | 2924 } |
2925 } | 2925 } |
2926 | 2926 |
2927 | 2927 |
2928 class _Uint32x4ArrayView extends _TypedListView implements Uint32x4List { | 2928 class _Int32x4ArrayView extends _TypedListView implements Int32x4List { |
2929 // Constructor. | 2929 // Constructor. |
2930 _Uint32x4ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length]) | 2930 _Int32x4ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length]) |
2931 : super(buffer, _offsetInBytes, | 2931 : super(buffer, _offsetInBytes, |
2932 _defaultIfNull(_length, | 2932 _defaultIfNull(_length, |
2933 ((buffer.lengthInBytes - _offsetInBytes) ~/ | 2933 ((buffer.lengthInBytes - _offsetInBytes) ~/ |
2934 Uint32x4List.BYTES_PER_ELEMENT))) { | 2934 Int32x4List.BYTES_PER_ELEMENT))) { |
2935 _rangeCheck(buffer.lengthInBytes, | 2935 _rangeCheck(buffer.lengthInBytes, |
2936 offsetInBytes, | 2936 offsetInBytes, |
2937 length * Uint32x4List.BYTES_PER_ELEMENT); | 2937 length * Int32x4List.BYTES_PER_ELEMENT); |
2938 _offsetAlignmentCheck(_offsetInBytes, Uint32x4List.BYTES_PER_ELEMENT); | 2938 _offsetAlignmentCheck(_offsetInBytes, Int32x4List.BYTES_PER_ELEMENT); |
2939 } | 2939 } |
2940 | 2940 |
2941 | 2941 |
2942 // Method(s) implementing List interface. | 2942 // Method(s) implementing List interface. |
2943 | 2943 |
2944 Uint32x4 operator[](int index) { | 2944 Int32x4 operator[](int index) { |
2945 if (index < 0 || index >= length) { | 2945 if (index < 0 || index >= length) { |
2946 _throwRangeError(index, length); | 2946 _throwRangeError(index, length); |
2947 } | 2947 } |
2948 return _typedData._getUint32x4(offsetInBytes + | 2948 return _typedData._getInt32x4(offsetInBytes + |
2949 (index * Uint32x4List.BYTES_PER_ELEMENT)); | 2949 (index * Int32x4List.BYTES_PER_ELEMENT)); |
2950 } | 2950 } |
2951 | 2951 |
2952 void operator[]=(int index, Uint32x4 value) { | 2952 void operator[]=(int index, Int32x4 value) { |
2953 if (index < 0 || index >= length) { | 2953 if (index < 0 || index >= length) { |
2954 _throwRangeError(index, length); | 2954 _throwRangeError(index, length); |
2955 } | 2955 } |
2956 _typedData._setUint32x4(offsetInBytes + | 2956 _typedData._setInt32x4(offsetInBytes + |
2957 (index * Uint32x4List.BYTES_PER_ELEMENT), value); | 2957 (index * Int32x4List.BYTES_PER_ELEMENT), value); |
2958 } | 2958 } |
2959 | 2959 |
2960 Iterator<Uint32x4> get iterator { | 2960 Iterator<Int32x4> get iterator { |
2961 return new _TypedListIterator<Uint32x4>(this); | 2961 return new _TypedListIterator<Int32x4>(this); |
2962 } | 2962 } |
2963 | 2963 |
2964 | 2964 |
2965 // Method(s) implementing TypedData interface. | 2965 // Method(s) implementing TypedData interface. |
2966 | 2966 |
2967 int get elementSizeInBytes { | 2967 int get elementSizeInBytes { |
2968 return Uint32x4List.BYTES_PER_ELEMENT; | 2968 return Int32x4List.BYTES_PER_ELEMENT; |
2969 } | 2969 } |
2970 | 2970 |
2971 | 2971 |
2972 // Internal utility methods. | 2972 // Internal utility methods. |
2973 | 2973 |
2974 Uint32x4List _createList(int length) { | 2974 Int32x4List _createList(int length) { |
2975 return new Uint32x4List(length); | 2975 return new Int32x4List(length); |
2976 } | 2976 } |
2977 } | 2977 } |
2978 | 2978 |
2979 | 2979 |
2980 class _ByteDataView implements ByteData { | 2980 class _ByteDataView implements ByteData { |
2981 _ByteDataView(ByteBuffer _buffer, int _offsetInBytes, int _lengthInBytes) | 2981 _ByteDataView(ByteBuffer _buffer, int _offsetInBytes, int _lengthInBytes) |
2982 : _typedData = _buffer, // _buffer is guaranteed to be a TypedData here. | 2982 : _typedData = _buffer, // _buffer is guaranteed to be a TypedData here. |
2983 _offset = _offsetInBytes, | 2983 _offset = _offsetInBytes, |
2984 length = _lengthInBytes { | 2984 length = _lengthInBytes { |
2985 _rangeCheck(_buffer.lengthInBytes, _offset, length); | 2985 _rangeCheck(_buffer.lengthInBytes, _offset, length); |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3341 return value; | 3341 return value; |
3342 } | 3342 } |
3343 return object; | 3343 return object; |
3344 } | 3344 } |
3345 | 3345 |
3346 | 3346 |
3347 void _throwRangeError(int index, int length) { | 3347 void _throwRangeError(int index, int length) { |
3348 String message = "$index must be in the range [0..$length)"; | 3348 String message = "$index must be in the range [0..$length)"; |
3349 throw new RangeError(message); | 3349 throw new RangeError(message); |
3350 } | 3350 } |
OLD | NEW |