| 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 /* patch */ factory Float64List.view(ByteBuffer buffer, | 217 /* patch */ factory Float64List.view(ByteBuffer buffer, |
| 218 [int offsetInBytes = 0, int length]) { | 218 [int offsetInBytes = 0, int length]) { |
| 219 return new _Float64ArrayView(buffer, offsetInBytes, length); | 219 return new _Float64ArrayView(buffer, offsetInBytes, length); |
| 220 } | 220 } |
| 221 | 221 |
| 222 static _ExternalFloat64Array _newTransferable(int length) { | 222 static _ExternalFloat64Array _newTransferable(int length) { |
| 223 return new _ExternalFloat64Array(length); | 223 return new _ExternalFloat64Array(length); |
| 224 } | 224 } |
| 225 } | 225 } |
| 226 | 226 |
| 227 patch class Float32x4List { |
| 228 /* patch */ factory Float32x4List(int length) { |
| 229 return new _Float32x4Array(length); |
| 230 } |
| 231 |
| 232 /* patch */ factory Float32x4List.transferable(int length) { |
| 233 return _newTransferable(length); |
| 234 } |
| 235 |
| 236 /* patch */ factory Float32x4List.view(ByteBuffer buffer, |
| 237 [int offsetInBytes = 0, int length]) { |
| 238 return new _Float32x4ArrayView(buffer, offsetInBytes, length); |
| 239 } |
| 240 |
| 241 static _ExternalFloat32x4Array _newTransferable(int length) { |
| 242 return new _ExternalFloat32x4Array(length); |
| 243 } |
| 244 } |
| 245 |
| 246 |
| 247 patch class Float32x4 { |
| 248 /* patch */ factory Float32x4(double x, double y, double z, double w) { |
| 249 return new _Float32x4(x, y, z, w); |
| 250 } |
| 251 /* patch */ factory Float32x4.zero() { |
| 252 return new _Float32x4.zero(); |
| 253 } |
| 254 } |
| 255 |
| 256 |
| 257 patch class Uint32x4 { |
| 258 /* patch */ factory Uint32x4(int x, int y, int z, int w) { |
| 259 return new _Uint32x4(x, y, z, w); |
| 260 } |
| 261 /* patch */ factory Uint32x4.bool(bool x, bool y, bool z, bool w) { |
| 262 return new _Uint32x4.bool(x, y, z, w); |
| 263 } |
| 264 } |
| 265 |
| 227 | 266 |
| 228 patch class ByteData { | 267 patch class ByteData { |
| 229 /* patch */ factory ByteData(int length) { | 268 /* patch */ factory ByteData(int length) { |
| 230 var list = new _Uint8Array(length); | 269 var list = new _Uint8Array(length); |
| 231 return new _ByteDataView(list.buffer, 0, length); | 270 return new _ByteDataView(list.buffer, 0, length); |
| 232 } | 271 } |
| 233 | 272 |
| 234 /* patch */ factory ByteData.transferable(int length) { | 273 /* patch */ factory ByteData.transferable(int length) { |
| 235 var list = new _Uint8Array.transferable(length); | 274 var list = new _Uint8Array.transferable(length); |
| 236 return new _ByteDataView(list.buffer, 0, length); | 275 return new _ByteDataView(list.buffer, 0, length); |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 int _getUint64(int offsetInBytes) native "TypedData_GetUint64"; | 555 int _getUint64(int offsetInBytes) native "TypedData_GetUint64"; |
| 517 void _setUint64(int offsetInBytes, int value) native "TypedData_SetUint64"; | 556 void _setUint64(int offsetInBytes, int value) native "TypedData_SetUint64"; |
| 518 | 557 |
| 519 double _getFloat32(int offsetInBytes) native "TypedData_GetFloat32"; | 558 double _getFloat32(int offsetInBytes) native "TypedData_GetFloat32"; |
| 520 void _setFloat32(int offsetInBytes, double value) | 559 void _setFloat32(int offsetInBytes, double value) |
| 521 native "TypedData_SetFloat32"; | 560 native "TypedData_SetFloat32"; |
| 522 | 561 |
| 523 double _getFloat64(int offsetInBytes) native "TypedData_GetFloat64"; | 562 double _getFloat64(int offsetInBytes) native "TypedData_GetFloat64"; |
| 524 void _setFloat64(int offsetInBytes, double value) | 563 void _setFloat64(int offsetInBytes, double value) |
| 525 native "TypedData_SetFloat64"; | 564 native "TypedData_SetFloat64"; |
| 565 |
| 566 Float32x4 _getFloat32x4(int offsetInBytes) native "TypedData_GetFloat32x4"; |
| 567 void _setFloat32x4(int offsetInBytes, Float32x4 value) |
| 568 native "TypedData_SetFloat32x4"; |
| 526 } | 569 } |
| 527 | 570 |
| 528 | 571 |
| 529 class _Int8Array extends _TypedList implements Int8List { | 572 class _Int8Array extends _TypedList implements Int8List { |
| 530 // Factory constructors. | 573 // Factory constructors. |
| 531 | 574 |
| 532 factory _Int8Array(int length) { | 575 factory _Int8Array(int length) { |
| 533 if (length < 0) { | 576 if (length < 0) { |
| 534 String message = "$length must be greater than 0"; | 577 String message = "$length must be greater than 0"; |
| 535 throw new ArgumentError(message); | 578 throw new ArgumentError(message); |
| (...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1248 return _getFloat64(index * Float64List.BYTES_PER_ELEMENT); | 1291 return _getFloat64(index * Float64List.BYTES_PER_ELEMENT); |
| 1249 } | 1292 } |
| 1250 | 1293 |
| 1251 void _setIndexedFloat64(int index, double value) { | 1294 void _setIndexedFloat64(int index, double value) { |
| 1252 _setFloat64(index * Float64List.BYTES_PER_ELEMENT, value); | 1295 _setFloat64(index * Float64List.BYTES_PER_ELEMENT, value); |
| 1253 } | 1296 } |
| 1254 | 1297 |
| 1255 static _Float64Array _new(int length) native "TypedData_Float64Array_new"; | 1298 static _Float64Array _new(int length) native "TypedData_Float64Array_new"; |
| 1256 } | 1299 } |
| 1257 | 1300 |
| 1301 class _Float32x4Array extends _TypedList implements Float32x4List { |
| 1302 // Factory constructors. |
| 1303 |
| 1304 factory _Float32x4Array(int length) { |
| 1305 if (length < 0) { |
| 1306 String message = "$length must be greater than 0"; |
| 1307 throw new ArgumentError(message); |
| 1308 } |
| 1309 return _new(length); |
| 1310 } |
| 1311 |
| 1312 factory _Float32x4Array.view(ByteBuffer buffer, |
| 1313 [int offsetInBytes = 0, int length]) { |
| 1314 if (length == null) { |
| 1315 length = (buffer.lengthInBytes - offsetInBytes) ~/ |
| 1316 Float32x4List.BYTES_PER_ELEMENT; |
| 1317 } |
| 1318 return new _Float32x4ArrayView(buffer, offsetInBytes, length); |
| 1319 } |
| 1320 |
| 1321 |
| 1322 Float32x4 operator[](int index) { |
| 1323 if (index < 0 || index >= length) { |
| 1324 String message = "$index must be in the range [0..$length)"; |
| 1325 throw new RangeError(message); |
| 1326 } |
| 1327 return _getIndexedFloat32x4(index); |
| 1328 } |
| 1329 |
| 1330 void operator[]=(int index, Float32x4 value) { |
| 1331 if (index < 0 || index >= length) { |
| 1332 String message = "$index must be in the range [0..$length)"; |
| 1333 throw new RangeError(message); |
| 1334 } |
| 1335 _setIndexedFloat32x4(index, value); |
| 1336 } |
| 1337 |
| 1338 Iterator<Float32x4> get iterator { |
| 1339 return new _TypedListIterator<Float32x4>(this); |
| 1340 } |
| 1341 |
| 1342 |
| 1343 // Method(s) implementing the TypedData interface. |
| 1344 |
| 1345 int get elementSizeInBytes { |
| 1346 return Float32x4List.BYTES_PER_ELEMENT; |
| 1347 } |
| 1348 |
| 1349 |
| 1350 // Internal utility methods. |
| 1351 |
| 1352 _Float32x4Array _createList(int length) { |
| 1353 return _new(length); |
| 1354 } |
| 1355 |
| 1356 Float32x4 _getIndexedFloat32x4(int index) { |
| 1357 return _getFloat32x4(index * Float32x4List.BYTES_PER_ELEMENT); |
| 1358 } |
| 1359 |
| 1360 void _setIndexedFloat32x4(int index, Float32x4 value) { |
| 1361 _setFloat32x4(index * Float32x4List.BYTES_PER_ELEMENT, value); |
| 1362 } |
| 1363 |
| 1364 static _Float32x4Array _new(int length) native "TypedData_Float32x4Array_new"; |
| 1365 } |
| 1366 |
| 1258 | 1367 |
| 1259 class _ExternalInt8Array extends _TypedList implements Int8List { | 1368 class _ExternalInt8Array extends _TypedList implements Int8List { |
| 1260 // Factory constructors. | 1369 // Factory constructors. |
| 1261 | 1370 |
| 1262 factory _ExternalInt8Array(int length) { | 1371 factory _ExternalInt8Array(int length) { |
| 1263 if (length < 0) { | 1372 if (length < 0) { |
| 1264 String message = "$length must be greater than 0"; | 1373 String message = "$length must be greater than 0"; |
| 1265 throw new ArgumentError(message); | 1374 throw new ArgumentError(message); |
| 1266 } | 1375 } |
| 1267 return _new(length); | 1376 return _new(length); |
| (...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1895 | 2004 |
| 1896 void _setIndexedFloat64(int index, double value) { | 2005 void _setIndexedFloat64(int index, double value) { |
| 1897 _setFloat64(index * Float64List.BYTES_PER_ELEMENT, value); | 2006 _setFloat64(index * Float64List.BYTES_PER_ELEMENT, value); |
| 1898 } | 2007 } |
| 1899 | 2008 |
| 1900 static _ExternalFloat64Array _new(int length) native | 2009 static _ExternalFloat64Array _new(int length) native |
| 1901 "ExternalTypedData_Float64Array_new"; | 2010 "ExternalTypedData_Float64Array_new"; |
| 1902 } | 2011 } |
| 1903 | 2012 |
| 1904 | 2013 |
| 2014 class _ExternalFloat32x4Array extends _TypedList implements Float32x4List { |
| 2015 // Factory constructors. |
| 2016 |
| 2017 factory _ExternalFloat32x4Array(int length) { |
| 2018 if (length < 0) { |
| 2019 String message = "$length must be greater than 0"; |
| 2020 throw new ArgumentError(message); |
| 2021 } |
| 2022 return _new(length); |
| 2023 } |
| 2024 |
| 2025 |
| 2026 // Method(s) implementing the List interface. |
| 2027 |
| 2028 Float32x4 operator[](int index) { |
| 2029 if (index < 0 || index >= length) { |
| 2030 String message = "$index must be in the range [0..$length)"; |
| 2031 throw new RangeError(message); |
| 2032 } |
| 2033 return _getIndexedFloat32x4(index); |
| 2034 } |
| 2035 |
| 2036 void operator[]=(int index, Float32x4 value) { |
| 2037 if (index < 0 || index >= length) { |
| 2038 String message = "$index must be in the range [0..$length)"; |
| 2039 throw new RangeError(message); |
| 2040 } |
| 2041 _setIndexedFloat32x4(index, value); |
| 2042 } |
| 2043 |
| 2044 Iterator<Float32x4> get iterator { |
| 2045 return new _TypedListIterator<Float32x4>(this); |
| 2046 } |
| 2047 |
| 2048 |
| 2049 // Method(s) implementing the TypedData interface. |
| 2050 |
| 2051 int get elementSizeInBytes { |
| 2052 return Float32x4List.BYTES_PER_ELEMENT; |
| 2053 } |
| 2054 |
| 2055 |
| 2056 // Internal utility methods. |
| 2057 |
| 2058 Float32x4List _createList(int length) { |
| 2059 return new Float32x4List(length); |
| 2060 } |
| 2061 |
| 2062 Float32x4 _getIndexedFloat32x4(int index) { |
| 2063 return _getFloat32x4(index * Float32x4List.BYTES_PER_ELEMENT); |
| 2064 } |
| 2065 |
| 2066 void _setIndexedFloat32x4(int index, Float32x4 value) { |
| 2067 _setFloat32x4(index * Float32x4List.BYTES_PER_ELEMENT, value); |
| 2068 } |
| 2069 |
| 2070 static _ExternalFloat32x4Array _new(int length) native |
| 2071 "ExternalTypedData_Float32x4Array_new"; |
| 2072 } |
| 2073 |
| 2074 |
| 2075 class _Float32x4 implements Float32x4 { |
| 2076 factory _Float32x4(double x, double y, double z, double w) |
| 2077 native "Float32x4_fromDoubles"; |
| 2078 factory _Float32x4.zero() native "Float32x4_zero"; |
| 2079 Float32x4 operator +(Float32x4 other) { |
| 2080 return _add(other); |
| 2081 } |
| 2082 Float32x4 _add(Float32x4 other) native "Float32x4_add"; |
| 2083 Float32x4 operator -() { |
| 2084 return _negate(); |
| 2085 } |
| 2086 Float32x4 _negate() native "Float32x4_negate"; |
| 2087 Float32x4 operator -(Float32x4 other) { |
| 2088 return _sub(other); |
| 2089 } |
| 2090 Float32x4 _sub(Float32x4 other) native "Float32x4_sub"; |
| 2091 Float32x4 operator *(Float32x4 other) { |
| 2092 return _mul(other); |
| 2093 } |
| 2094 Float32x4 _mul(Float32x4 other) native "Float32x4_mul"; |
| 2095 Float32x4 operator /(Float32x4 other) { |
| 2096 return _div(other); |
| 2097 } |
| 2098 Float32x4 _div(Float32x4 other) native "Float32x4_div"; |
| 2099 Uint32x4 lessThan(Float32x4 other) { |
| 2100 return _cmplt(other); |
| 2101 } |
| 2102 Uint32x4 _cmplt(Float32x4 other) native "Float32x4_cmplt"; |
| 2103 Uint32x4 lessThanOrEqual(Float32x4 other) { |
| 2104 return _cmplte(other); |
| 2105 } |
| 2106 Uint32x4 _cmplte(Float32x4 other) native "Float32x4_cmplte"; |
| 2107 Uint32x4 greaterThan(Float32x4 other) { |
| 2108 return _cmpgt(other); |
| 2109 } |
| 2110 Uint32x4 _cmpgt(Float32x4 other) native "Float32x4_cmpgt"; |
| 2111 Uint32x4 greaterThanOrEqual(Float32x4 other) { |
| 2112 return _cmpgte(other); |
| 2113 } |
| 2114 Uint32x4 _cmpgte(Float32x4 other) native "Float32x4_cmpgte"; |
| 2115 Uint32x4 equal(Float32x4 other) { |
| 2116 return _cmpequal(other); |
| 2117 } |
| 2118 Uint32x4 _cmpequal(Float32x4 other) |
| 2119 native "Float32x4_cmpequal"; |
| 2120 Uint32x4 notEqual(Float32x4 other) { |
| 2121 return _cmpnequal(other); |
| 2122 } |
| 2123 Uint32x4 _cmpnequal(Float32x4 other) |
| 2124 native "Float32x4_cmpnequal"; |
| 2125 Float32x4 scale(double s) { |
| 2126 return _scale(s); |
| 2127 } |
| 2128 Float32x4 _scale(double s) native "Float32x4_scale"; |
| 2129 Float32x4 abs() { |
| 2130 return _abs(); |
| 2131 } |
| 2132 Float32x4 _abs() native "Float32x4_abs"; |
| 2133 Float32x4 clamp(Float32x4 lowerLimit, |
| 2134 Float32x4 upperLimit) { |
| 2135 return _clamp(lowerLimit, upperLimit); |
| 2136 } |
| 2137 Float32x4 _clamp(Float32x4 lowerLimit, |
| 2138 Float32x4 upperLimit) |
| 2139 native "Float32x4_clamp"; |
| 2140 double get x native "Float32x4_getX"; |
| 2141 double get y native "Float32x4_getY"; |
| 2142 double get z native "Float32x4_getZ"; |
| 2143 double get w native "Float32x4_getW"; |
| 2144 Float32x4 get xxxx native "Float32x4_getXXXX"; |
| 2145 Float32x4 get yyyy native "Float32x4_getYYYY"; |
| 2146 Float32x4 get zzzz native "Float32x4_getZZZZ"; |
| 2147 Float32x4 get wwww native "Float32x4_getWWWW"; |
| 2148 Float32x4 withX(double x) native "Float32x4_setX"; |
| 2149 Float32x4 withY(double y) native "Float32x4_setY"; |
| 2150 Float32x4 withZ(double z) native "Float32x4_setZ"; |
| 2151 Float32x4 withW(double w) native "Float32x4_setW"; |
| 2152 Float32x4 min(Float32x4 other) { |
| 2153 return _min(other); |
| 2154 } |
| 2155 Float32x4 _min(Float32x4 other) native "Float32x4_min"; |
| 2156 Float32x4 max(Float32x4 other) { |
| 2157 return _max(other); |
| 2158 } |
| 2159 Float32x4 _max(Float32x4 other) native "Float32x4_max"; |
| 2160 Float32x4 sqrt() { |
| 2161 return _sqrt(); |
| 2162 } |
| 2163 Float32x4 _sqrt() native "Float32x4_sqrt"; |
| 2164 Float32x4 reciprocal() { |
| 2165 return _reciprocal(); |
| 2166 } |
| 2167 Float32x4 _reciprocal() native "Float32x4_reciprocal"; |
| 2168 Float32x4 reciprocalSqrt() { |
| 2169 return _reciprocalSqrt(); |
| 2170 } |
| 2171 Float32x4 _reciprocalSqrt() native "Float32x4_reciprocalSqrt"; |
| 2172 Uint32x4 toUint32x4() { |
| 2173 return _toUint32x4(); |
| 2174 } |
| 2175 Uint32x4 _toUint32x4() native "Float32x4_toUint32x4"; |
| 2176 } |
| 2177 |
| 2178 |
| 2179 class _Uint32x4 implements Uint32x4 { |
| 2180 factory _Uint32x4(int x, int y, int z, int w) |
| 2181 native "Uint32x4_fromInts"; |
| 2182 factory _Uint32x4.bool(bool x, bool y, bool z, bool w) |
| 2183 native "Uint32x4_fromBools"; |
| 2184 Uint32x4 operator |(Uint32x4 other) { |
| 2185 return _or(other); |
| 2186 } |
| 2187 Uint32x4 _or(Uint32x4 other) native "Uint32x4_or"; |
| 2188 Uint32x4 operator &(Uint32x4 other) { |
| 2189 return _and(other); |
| 2190 } |
| 2191 Uint32x4 _and(Uint32x4 other) native "Uint32x4_and"; |
| 2192 Uint32x4 operator ^(Uint32x4 other) { |
| 2193 return _xor(other); |
| 2194 } |
| 2195 Uint32x4 _xor(Uint32x4 other) native "Uint32x4_xor"; |
| 2196 int get x native "Uint32x4_getX"; |
| 2197 int get y native "Uint32x4_getY"; |
| 2198 int get z native "Uint32x4_getZ"; |
| 2199 int get w native "Uint32x4_getW"; |
| 2200 Uint32x4 withX(int x) native "Uint32x4_setX"; |
| 2201 Uint32x4 withY(int y) native "Uint32x4_setY"; |
| 2202 Uint32x4 withZ(int z) native "Uint32x4_setZ"; |
| 2203 Uint32x4 withW(int w) native "Uint32x4_setW"; |
| 2204 bool get flagX native "Uint32x4_getFlagX"; |
| 2205 bool get flagY native "Uint32x4_getFlagY"; |
| 2206 bool get flagZ native "Uint32x4_getFlagZ"; |
| 2207 bool get flagW native "Uint32x4_getFlagW"; |
| 2208 Uint32x4 withFlagX(bool x) native "Uint32x4_setFlagX"; |
| 2209 Uint32x4 withFlagY(bool y) native "Uint32x4_setFlagY"; |
| 2210 Uint32x4 withFlagZ(bool z) native "Uint32x4_setFlagZ"; |
| 2211 Uint32x4 withFlagW(bool w) native "Uint32x4_setFlagW"; |
| 2212 Float32x4 select(Float32x4 trueValue, |
| 2213 Float32x4 falseValue) { |
| 2214 return _select(trueValue, falseValue); |
| 2215 } |
| 2216 Float32x4 _select(Float32x4 trueValue, |
| 2217 Float32x4 falseValue) |
| 2218 native "Uint32x4_select"; |
| 2219 Float32x4 toFloat32x4() { |
| 2220 return _toFloat32x4(); |
| 2221 } |
| 2222 Float32x4 _toFloat32x4() native "Uint32x4_toFloat32x4"; |
| 2223 } |
| 2224 |
| 1905 class _TypedListIterator<E> implements Iterator<E> { | 2225 class _TypedListIterator<E> implements Iterator<E> { |
| 1906 final List<E> _array; | 2226 final List<E> _array; |
| 1907 final int _length; | 2227 final int _length; |
| 1908 int _position; | 2228 int _position; |
| 1909 E _current; | 2229 E _current; |
| 1910 | 2230 |
| 1911 _TypedListIterator(List array) | 2231 _TypedListIterator(List array) |
| 1912 : _array = array, _length = array.length, _position = -1 { | 2232 : _array = array, _length = array.length, _position = -1 { |
| 1913 assert(array is _TypedList || array is _TypedListView); | 2233 assert(array is _TypedList || array is _TypedListView); |
| 1914 } | 2234 } |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2453 | 2773 |
| 2454 | 2774 |
| 2455 // Method(s) implementing TypedData interface. | 2775 // Method(s) implementing TypedData interface. |
| 2456 | 2776 |
| 2457 int get elementSizeInBytes { | 2777 int get elementSizeInBytes { |
| 2458 return Float64List.BYTES_PER_ELEMENT; | 2778 return Float64List.BYTES_PER_ELEMENT; |
| 2459 } | 2779 } |
| 2460 } | 2780 } |
| 2461 | 2781 |
| 2462 | 2782 |
| 2783 class _Float32x4ArrayView extends _TypedListView implements Float32x4List { |
| 2784 // Constructor. |
| 2785 _Float32x4ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length]) |
| 2786 : super(buffer, _offsetInBytes, |
| 2787 _defaultIfNull(_length, |
| 2788 ((buffer.lengthInBytes - _offsetInBytes) ~/ |
| 2789 Float32x4List.BYTES_PER_ELEMENT))) { |
| 2790 _rangeCheck(buffer.lengthInBytes, |
| 2791 offsetInBytes, |
| 2792 length * Float32x4List.BYTES_PER_ELEMENT); |
| 2793 } |
| 2794 |
| 2795 |
| 2796 // Method(s) implementing List interface. |
| 2797 |
| 2798 Float32x4 operator[](int index) { |
| 2799 if (index < 0 || index >= length) { |
| 2800 String message = "$index must be in the range [0..$length)"; |
| 2801 throw new RangeError(message); |
| 2802 } |
| 2803 return _typeddata._getFloat32x4(offsetInBytes + |
| 2804 (index * Float32x4List.BYTES_PER_ELEMENT)); |
| 2805 } |
| 2806 |
| 2807 void operator[]=(int index, Float32x4 value) { |
| 2808 if (index < 0 || index >= length) { |
| 2809 String message = "$index must be in the range [0..$length)"; |
| 2810 throw new RangeError(message); |
| 2811 } |
| 2812 _typeddata._setFloat32x4(offsetInBytes + |
| 2813 (index * Float32x4List.BYTES_PER_ELEMENT), value); |
| 2814 } |
| 2815 |
| 2816 Iterator<Float32x4> get iterator { |
| 2817 return new _TypedListIterator<Float32x4>(this); |
| 2818 } |
| 2819 |
| 2820 |
| 2821 // Method(s) implementing TypedData interface. |
| 2822 |
| 2823 int get elementSizeInBytes { |
| 2824 return Float32x4List.BYTES_PER_ELEMENT; |
| 2825 } |
| 2826 } |
| 2827 |
| 2828 |
| 2463 class _ByteDataView implements ByteData { | 2829 class _ByteDataView implements ByteData { |
| 2464 _ByteDataView(ByteBuffer _buffer, int _offsetInBytes, int _lengthInBytes) | 2830 _ByteDataView(ByteBuffer _buffer, int _offsetInBytes, int _lengthInBytes) |
| 2465 : _typeddata = _buffer as TypedData, | 2831 : _typeddata = _buffer as TypedData, |
| 2466 _offset = _offsetInBytes, | 2832 _offset = _offsetInBytes, |
| 2467 length = _lengthInBytes { | 2833 length = _lengthInBytes { |
| 2468 _rangeCheck(_buffer.lengthInBytes, _offset, length); | 2834 _rangeCheck(_buffer.lengthInBytes, _offset, length); |
| 2469 } | 2835 } |
| 2470 | 2836 |
| 2471 | 2837 |
| 2472 // Method(s) implementing TypedData interface. | 2838 // Method(s) implementing TypedData interface. |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2548 _typeddata._setFloat32(_offset + byteOffset, value); | 2914 _typeddata._setFloat32(_offset + byteOffset, value); |
| 2549 } | 2915 } |
| 2550 | 2916 |
| 2551 double getFloat64(int byteOffset) { | 2917 double getFloat64(int byteOffset) { |
| 2552 return _typeddata._getFloat64(_offset + byteOffset); | 2918 return _typeddata._getFloat64(_offset + byteOffset); |
| 2553 } | 2919 } |
| 2554 void setFloat64(int byteOffset, double value) { | 2920 void setFloat64(int byteOffset, double value) { |
| 2555 _typeddata._setFloat64(_offset + byteOffset, value); | 2921 _typeddata._setFloat64(_offset + byteOffset, value); |
| 2556 } | 2922 } |
| 2557 | 2923 |
| 2924 Float32x4 getFloat32x4(int byteOffset) { |
| 2925 return _typeddata._getFloat32x4(_offset + byteOffset); |
| 2926 } |
| 2927 void setFloat32x4(int byteOffset, Float32x4 value) { |
| 2928 _typeddata._setFloat32x4(_offset + byteOffset, value); |
| 2929 |
| 2930 } |
| 2931 |
| 2558 final TypedData _typeddata; | 2932 final TypedData _typeddata; |
| 2559 final int _offset; | 2933 final int _offset; |
| 2560 final int length; | 2934 final int length; |
| 2561 } | 2935 } |
| 2562 | 2936 |
| 2563 | 2937 |
| 2564 // Top level utility methods. | 2938 // Top level utility methods. |
| 2565 int _toInt(int value, int mask) { | 2939 int _toInt(int value, int mask) { |
| 2566 value &= mask; | 2940 value &= mask; |
| 2567 if (value > (mask >> 1)) value -= mask + 1; | 2941 if (value > (mask >> 1)) value -= mask + 1; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2628 } | 3002 } |
| 2629 } | 3003 } |
| 2630 | 3004 |
| 2631 | 3005 |
| 2632 int _defaultIfNull(object, value) { | 3006 int _defaultIfNull(object, value) { |
| 2633 if (object == null) { | 3007 if (object == null) { |
| 2634 return value; | 3008 return value; |
| 2635 } | 3009 } |
| 2636 return object; | 3010 return object; |
| 2637 } | 3011 } |
| OLD | NEW |