Chromium Code Reviews| 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); | 270 return new _ByteDataView(list.buffer); |
| 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); | 275 return new _ByteDataView(list.buffer); |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 497 void _setInt64(int index, int value) native "TypedData_SetInt64"; | 536 void _setInt64(int index, int value) native "TypedData_SetInt64"; |
| 498 | 537 |
| 499 int _getUint64(int index) native "TypedData_GetUint64"; | 538 int _getUint64(int index) native "TypedData_GetUint64"; |
| 500 void _setUint64(int index, int value) native "TypedData_SetUint64"; | 539 void _setUint64(int index, int value) native "TypedData_SetUint64"; |
| 501 | 540 |
| 502 double _getFloat32(int index) native "TypedData_GetFloat32"; | 541 double _getFloat32(int index) native "TypedData_GetFloat32"; |
| 503 void _setFloat32(int index, double value) native "TypedData_SetFloat32"; | 542 void _setFloat32(int index, double value) native "TypedData_SetFloat32"; |
| 504 | 543 |
| 505 double _getFloat64(int index) native "TypedData_GetFloat64"; | 544 double _getFloat64(int index) native "TypedData_GetFloat64"; |
| 506 void _setFloat64(int index, double value) native "TypedData_SetFloat64"; | 545 void _setFloat64(int index, double value) native "TypedData_SetFloat64"; |
| 546 | |
| 547 Float32x4 _getFloat32x4(int index) native "TypedData_GetFloat32x4"; | |
| 548 void _setFloat32x4(int index, Float32x4 value) | |
| 549 native "TypedData_SetFloat32x4"; | |
| 507 } | 550 } |
| 508 | 551 |
| 509 | 552 |
| 510 class _Int8Array extends _TypedList implements Int8List { | 553 class _Int8Array extends _TypedList implements Int8List { |
| 511 // Factory constructors. | 554 // Factory constructors. |
| 512 | 555 |
| 513 factory _Int8Array(int length) { | 556 factory _Int8Array(int length) { |
| 514 if (length < 0) { | 557 if (length < 0) { |
| 515 String message = "$length must be greater than 0"; | 558 String message = "$length must be greater than 0"; |
| 516 throw new ArgumentError(message); | 559 throw new ArgumentError(message); |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1120 int get elementSizeInBytes { | 1163 int get elementSizeInBytes { |
| 1121 return Float64List.BYTES_PER_ELEMENT; | 1164 return Float64List.BYTES_PER_ELEMENT; |
| 1122 } | 1165 } |
| 1123 | 1166 |
| 1124 | 1167 |
| 1125 // Internal utility methods. | 1168 // Internal utility methods. |
| 1126 | 1169 |
| 1127 static _Float64Array _new(int length) native "TypedData_Float64Array_new"; | 1170 static _Float64Array _new(int length) native "TypedData_Float64Array_new"; |
| 1128 } | 1171 } |
| 1129 | 1172 |
| 1173 class _Float32x4Array extends _TypedList implements Float32x4List { | |
| 1174 // Factory constructors. | |
| 1175 | |
| 1176 factory _Float32x4Array(int length) { | |
| 1177 if (length < 0) { | |
| 1178 String message = "$length must be greater than 0"; | |
| 1179 throw new ArgumentError(message); | |
| 1180 } | |
| 1181 return _new(length); | |
| 1182 } | |
| 1183 | |
| 1184 factory _Float32x4Array.view(ByteBuffer buffer, | |
| 1185 [int offsetInBytes = 0, int length]) { | |
| 1186 if (length == null) { | |
| 1187 length = (buffer.lengthInBytes - offsetInBytes) ~/ | |
| 1188 Float32x4List.BYTES_PER_ELEMENT; | |
| 1189 } | |
| 1190 return new _Float32x4ArrayView(buffer, offsetInBytes, length); | |
| 1191 } | |
| 1192 | |
| 1193 | |
| 1194 // Method(s) implementing the List interface. | |
| 1195 | |
| 1196 Float32x4 operator[](int index) { | |
| 1197 if (index < 0 || index >= length) { | |
| 1198 String message = "$index must be in the range [0..$length)"; | |
| 1199 throw new RangeError(message); | |
| 1200 } | |
| 1201 return _getFloat32x4(index); | |
| 1202 } | |
| 1203 | |
| 1204 void operator[]=(int index, Float32x4 value) { | |
| 1205 if (index < 0 || index >= length) { | |
| 1206 String message = "$index must be in the range [0..$length)"; | |
| 1207 throw new RangeError(message); | |
| 1208 } | |
| 1209 _setFloat32x4(index, value); | |
| 1210 } | |
| 1211 | |
| 1212 Iterator<Float32x4> get iterator { | |
| 1213 return new _TypedListIterator<Float32x4>(this); | |
| 1214 } | |
| 1215 | |
| 1216 | |
| 1217 // Method(s) implementing the TypedData interface. | |
| 1218 | |
| 1219 int get elementSizeInBytes { | |
| 1220 return Float32x4List.BYTES_PER_ELEMENT; | |
| 1221 } | |
| 1222 | |
| 1223 | |
| 1224 // Internal utility methods. | |
|
siva
2013/03/12 11:44:22
If you sync up to the latest sources there is a ne
Cutch
2013/03/25 21:06:35
Done.
| |
| 1225 | |
| 1226 static _Float32x4Array _new(int length) native "TypedData_Float32x4Array_new"; | |
| 1227 } | |
| 1228 | |
| 1130 | 1229 |
| 1131 class _ExternalInt8Array extends _TypedList implements Int8List { | 1230 class _ExternalInt8Array extends _TypedList implements Int8List { |
| 1132 // Factory constructors. | 1231 // Factory constructors. |
| 1133 | 1232 |
| 1134 factory _ExternalInt8Array(int length) { | 1233 factory _ExternalInt8Array(int length) { |
| 1135 if (length < 0) { | 1234 if (length < 0) { |
| 1136 String message = "$length must be greater than 0"; | 1235 String message = "$length must be greater than 0"; |
| 1137 throw new ArgumentError(message); | 1236 throw new ArgumentError(message); |
| 1138 } | 1237 } |
| 1139 return _new(length); | 1238 return _new(length); |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1367 | 1466 |
| 1368 // Internal utility methods. | 1467 // Internal utility methods. |
| 1369 | 1468 |
| 1370 static _ExternalUint16Array _new(int length) native | 1469 static _ExternalUint16Array _new(int length) native |
| 1371 "ExternalTypedData_Uint16Array_new"; | 1470 "ExternalTypedData_Uint16Array_new"; |
| 1372 } | 1471 } |
| 1373 | 1472 |
| 1374 | 1473 |
| 1375 class _ExternalInt32Array extends _TypedList implements Int32List { | 1474 class _ExternalInt32Array extends _TypedList implements Int32List { |
| 1376 // Factory constructors. | 1475 // Factory constructors. |
| 1377 | 1476 |
| 1378 factory _ExternalInt32Array(int length) { | 1477 factory _ExternalInt32Array(int length) { |
| 1379 if (length < 0) { | 1478 if (length < 0) { |
| 1380 String message = "$length must be greater than 0"; | 1479 String message = "$length must be greater than 0"; |
| 1381 throw new ArgumentError(message); | 1480 throw new ArgumentError(message); |
| 1382 } | 1481 } |
| 1383 return _new(length); | 1482 return _new(length); |
| 1384 } | 1483 } |
| 1385 | 1484 |
| 1386 | 1485 |
| 1387 // Method(s) implementing the List interface. | 1486 // Method(s) implementing the List interface. |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1659 } | 1758 } |
| 1660 | 1759 |
| 1661 | 1760 |
| 1662 // Internal utility methods. | 1761 // Internal utility methods. |
| 1663 | 1762 |
| 1664 static _ExternalFloat64Array _new(int length) native | 1763 static _ExternalFloat64Array _new(int length) native |
| 1665 "ExternalTypedData_Float64Array_new"; | 1764 "ExternalTypedData_Float64Array_new"; |
| 1666 } | 1765 } |
| 1667 | 1766 |
| 1668 | 1767 |
| 1768 class _ExternalFloat32x4Array extends _TypedList implements Float32x4List { | |
| 1769 // Factory constructors. | |
| 1770 | |
| 1771 factory _ExternalFloat32x4Array(int length) { | |
| 1772 if (length < 0) { | |
| 1773 String message = "$length must be greater than 0"; | |
| 1774 throw new ArgumentError(message); | |
| 1775 } | |
| 1776 return _new(length); | |
| 1777 } | |
| 1778 | |
| 1779 | |
| 1780 // Method(s) implementing the List interface. | |
| 1781 | |
| 1782 Float32x4 operator[](int index) { | |
| 1783 if (index < 0 || index >= length) { | |
| 1784 String message = "$index must be in the range [0..$length)"; | |
| 1785 throw new RangeError(message); | |
| 1786 } | |
| 1787 return _getFloat32x4(index); | |
| 1788 } | |
| 1789 | |
| 1790 void operator[]=(int index, Float32x4 value) { | |
| 1791 if (index < 0 || index >= length) { | |
| 1792 String message = "$index must be in the range [0..$length)"; | |
| 1793 throw new RangeError(message); | |
| 1794 } | |
| 1795 _setFloat32x4(index, value); | |
| 1796 } | |
| 1797 | |
| 1798 Iterator<Float32x4> get iterator { | |
| 1799 return new _TypedListIterator<Float32x4>(this); | |
| 1800 } | |
| 1801 | |
| 1802 | |
| 1803 // Method(s) implementing the TypedData interface. | |
| 1804 | |
| 1805 int get elementSizeInBytes { | |
| 1806 return Float32x4List.BYTES_PER_ELEMENT; | |
| 1807 } | |
| 1808 | |
| 1809 | |
| 1810 // Internal utility methods. | |
| 1811 | |
| 1812 static _ExternalFloat32x4Array _new(int length) native | |
| 1813 "ExternalTypedData_Float32x4Array_new"; | |
| 1814 } | |
| 1815 | |
| 1816 | |
| 1817 class _Float32x4 implements Float32x4 { | |
| 1818 factory _Float32x4(double x, double y, double z, double w) | |
| 1819 native "Float32x4_fromDoubles"; | |
| 1820 factory _Float32x4.zero() native "Float32x4_zero"; | |
| 1821 Float32x4 operator +(Float32x4 other) { | |
| 1822 return _add(other); | |
| 1823 } | |
| 1824 Float32x4 _add(Float32x4 other) native "Float32x4_add"; | |
| 1825 Float32x4 operator -() { | |
| 1826 return _negate(); | |
| 1827 } | |
| 1828 Float32x4 _negate() native "Float32x4_negate"; | |
| 1829 Float32x4 operator -(Float32x4 other) { | |
| 1830 return _sub(other); | |
| 1831 } | |
| 1832 Float32x4 _sub(Float32x4 other) native "Float32x4_sub"; | |
| 1833 Float32x4 operator *(Float32x4 other) { | |
| 1834 return _mul(other); | |
| 1835 } | |
| 1836 Float32x4 _mul(Float32x4 other) native "Float32x4_mul"; | |
| 1837 Float32x4 operator /(Float32x4 other) { | |
| 1838 return _div(other); | |
| 1839 } | |
| 1840 Float32x4 _div(Float32x4 other) native "Float32x4_div"; | |
| 1841 Uint32x4 lessThan(Float32x4 other) { | |
| 1842 return _cmplt(other); | |
| 1843 } | |
| 1844 Uint32x4 _cmplt(Float32x4 other) native "Float32x4_cmplt"; | |
| 1845 Uint32x4 lessThanOrEqual(Float32x4 other) { | |
| 1846 return _cmplte(other); | |
| 1847 } | |
| 1848 Uint32x4 _cmplte(Float32x4 other) native "Float32x4_cmplte"; | |
| 1849 Uint32x4 greaterThan(Float32x4 other) { | |
| 1850 return _cmpgt(other); | |
| 1851 } | |
| 1852 Uint32x4 _cmpgt(Float32x4 other) native "Float32x4_cmpgt"; | |
| 1853 Uint32x4 greaterThanOrEqual(Float32x4 other) { | |
| 1854 return _cmpgte(other); | |
| 1855 } | |
| 1856 Uint32x4 _cmpgte(Float32x4 other) native "Float32x4_cmpgte"; | |
| 1857 Uint32x4 equal(Float32x4 other) { | |
| 1858 return _cmpequal(other); | |
| 1859 } | |
| 1860 Uint32x4 _cmpequal(Float32x4 other) | |
| 1861 native "Float32x4_cmpequal"; | |
| 1862 Uint32x4 notEqual(Float32x4 other) { | |
| 1863 return _cmpnequal(other); | |
| 1864 } | |
| 1865 Uint32x4 _cmpnequal(Float32x4 other) | |
| 1866 native "Float32x4_cmpnequal"; | |
| 1867 Float32x4 scale(double s) { | |
| 1868 return _scale(s); | |
| 1869 } | |
| 1870 Float32x4 _scale(double s) native "Float32x4_scale"; | |
| 1871 Float32x4 abs() { | |
| 1872 return _abs(); | |
| 1873 } | |
| 1874 Float32x4 _abs() native "Float32x4_abs"; | |
| 1875 Float32x4 clamp(Float32x4 lowerLimit, | |
| 1876 Float32x4 upperLimit) { | |
| 1877 return _clamp(lowerLimit, upperLimit); | |
| 1878 } | |
| 1879 Float32x4 _clamp(Float32x4 lowerLimit, | |
| 1880 Float32x4 upperLimit) | |
| 1881 native "Float32x4_clamp"; | |
| 1882 double get x native "Float32x4_getX"; | |
| 1883 double get y native "Float32x4_getY"; | |
| 1884 double get z native "Float32x4_getZ"; | |
| 1885 double get w native "Float32x4_getW"; | |
| 1886 Float32x4 get xxxx native "Float32x4_getXXXX"; | |
| 1887 Float32x4 get yyyy native "Float32x4_getYYYY"; | |
| 1888 Float32x4 get zzzz native "Float32x4_getZZZZ"; | |
| 1889 Float32x4 get wwww native "Float32x4_getWWWW"; | |
| 1890 Float32x4 withX(double x) native "Float32x4_setX"; | |
| 1891 Float32x4 withY(double y) native "Float32x4_setY"; | |
| 1892 Float32x4 withZ(double z) native "Float32x4_setZ"; | |
| 1893 Float32x4 withW(double w) native "Float32x4_setW"; | |
| 1894 Float32x4 min(Float32x4 other) { | |
| 1895 return _min(other); | |
| 1896 } | |
| 1897 Float32x4 _min(Float32x4 other) native "Float32x4_min"; | |
| 1898 Float32x4 max(Float32x4 other) { | |
| 1899 return _max(other); | |
| 1900 } | |
| 1901 Float32x4 _max(Float32x4 other) native "Float32x4_max"; | |
| 1902 Float32x4 sqrt() { | |
| 1903 return _sqrt(); | |
| 1904 } | |
| 1905 Float32x4 _sqrt() native "Float32x4_sqrt"; | |
| 1906 Float32x4 reciprocal() { | |
| 1907 return _reciprocal(); | |
| 1908 } | |
| 1909 Float32x4 _reciprocal() native "Float32x4_reciprocal"; | |
| 1910 Float32x4 reciprocalSqrt() { | |
| 1911 return _reciprocalSqrt(); | |
| 1912 } | |
| 1913 Float32x4 _reciprocalSqrt() native "Float32x4_reciprocalSqrt"; | |
| 1914 Uint32x4 toUint32x4() { | |
| 1915 return _toUint32x4(); | |
| 1916 } | |
| 1917 Uint32x4 _toUint32x4() native "Float32x4_toUint32x4"; | |
| 1918 } | |
| 1919 | |
| 1920 | |
| 1921 class _Uint32x4 implements Uint32x4 { | |
| 1922 factory _Uint32x4(int x, int y, int z, int w) | |
| 1923 native "Uint32x4_fromInts"; | |
| 1924 factory _Uint32x4.bool(bool x, bool y, bool z, bool w) | |
| 1925 native "Uint32x4_fromBools"; | |
| 1926 Uint32x4 operator |(Uint32x4 other) { | |
| 1927 return _or(other); | |
| 1928 } | |
| 1929 Uint32x4 _or(Uint32x4 other) native "Uint32x4_or"; | |
| 1930 Uint32x4 operator &(Uint32x4 other) { | |
| 1931 return _and(other); | |
| 1932 } | |
| 1933 Uint32x4 _and(Uint32x4 other) native "Uint32x4_and"; | |
| 1934 Uint32x4 operator ^(Uint32x4 other) { | |
| 1935 return _xor(other); | |
| 1936 } | |
| 1937 Uint32x4 _xor(Uint32x4 other) native "Uint32x4_xor"; | |
| 1938 int get x native "Uint32x4_getX"; | |
| 1939 int get y native "Uint32x4_getY"; | |
| 1940 int get z native "Uint32x4_getZ"; | |
| 1941 int get w native "Uint32x4_getW"; | |
| 1942 Uint32x4 withX(int x) native "Uint32x4_setX"; | |
| 1943 Uint32x4 withY(int y) native "Uint32x4_setY"; | |
| 1944 Uint32x4 withZ(int z) native "Uint32x4_setZ"; | |
| 1945 Uint32x4 withW(int w) native "Uint32x4_setW"; | |
| 1946 bool get flagX native "Uint32x4_getFlagX"; | |
| 1947 bool get flagY native "Uint32x4_getFlagY"; | |
| 1948 bool get flagZ native "Uint32x4_getFlagZ"; | |
| 1949 bool get flagW native "Uint32x4_getFlagW"; | |
| 1950 Uint32x4 withFlagX(bool x) native "Uint32x4_setFlagX"; | |
| 1951 Uint32x4 withFlagY(bool y) native "Uint32x4_setFlagY"; | |
| 1952 Uint32x4 withFlagZ(bool z) native "Uint32x4_setFlagZ"; | |
| 1953 Uint32x4 withFlagW(bool w) native "Uint32x4_setFlagW"; | |
| 1954 Float32x4 select(Float32x4 trueValue, | |
| 1955 Float32x4 falseValue) { | |
| 1956 return _select(trueValue, falseValue); | |
| 1957 } | |
| 1958 Float32x4 _select(Float32x4 trueValue, | |
| 1959 Float32x4 falseValue) | |
| 1960 native "Uint32x4_select"; | |
| 1961 Float32x4 toFloat32x4() { | |
| 1962 return _toFloat32x4(); | |
| 1963 } | |
| 1964 Float32x4 _toFloat32x4() native "Uint32x4_toFloat32x4"; | |
| 1965 } | |
| 1966 | |
| 1669 class _TypedListIterator<E> implements Iterator<E> { | 1967 class _TypedListIterator<E> implements Iterator<E> { |
| 1670 final List<E> _array; | 1968 final List<E> _array; |
| 1671 final int _length; | 1969 final int _length; |
| 1672 int _position; | 1970 int _position; |
| 1673 E _current; | 1971 E _current; |
| 1674 | 1972 |
| 1675 _TypedListIterator(List array) | 1973 _TypedListIterator(List array) |
| 1676 : _array = array, _length = array.length, _position = -1 { | 1974 : _array = array, _length = array.length, _position = -1 { |
| 1677 assert(array is _TypedList || array is _TypedListView); | 1975 assert(array is _TypedList || array is _TypedListView); |
| 1678 } | 1976 } |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2217 | 2515 |
| 2218 | 2516 |
| 2219 // Method(s) implementing TypedData interface. | 2517 // Method(s) implementing TypedData interface. |
| 2220 | 2518 |
| 2221 int get elementSizeInBytes { | 2519 int get elementSizeInBytes { |
| 2222 return Float64List.BYTES_PER_ELEMENT; | 2520 return Float64List.BYTES_PER_ELEMENT; |
| 2223 } | 2521 } |
| 2224 } | 2522 } |
| 2225 | 2523 |
| 2226 | 2524 |
| 2525 class _Float32x4ArrayView extends _TypedListView implements Float32x4List { | |
| 2526 // Constructor. | |
| 2527 _Float32x4ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length]) | |
| 2528 : super(buffer, _offsetInBytes, | |
| 2529 _defaultIfNull(_length, | |
| 2530 ((buffer.lengthInBytes - _offsetInBytes) ~/ | |
| 2531 Float32x4List.BYTES_PER_ELEMENT))) { | |
| 2532 _rangeCheck(buffer.lengthInBytes, | |
| 2533 offsetInBytes, | |
| 2534 length * Float32x4List.BYTES_PER_ELEMENT); | |
| 2535 } | |
| 2536 | |
| 2537 | |
| 2538 // Method(s) implementing List interface. | |
| 2539 | |
| 2540 Float32x4 operator[](int index) { | |
| 2541 if (index < 0 || index >= length) { | |
| 2542 String message = "$index must be in the range [0..$length)"; | |
| 2543 throw new RangeError(message); | |
| 2544 } | |
| 2545 return _typeddata.getFloat32x4(offsetInBytes + | |
| 2546 index * Float32x4List.BYTES_PER_ELEMENT); | |
| 2547 } | |
| 2548 | |
| 2549 void operator[]=(int index, Float32x4 value) { | |
| 2550 if (index < 0 || index >= length) { | |
| 2551 String message = "$index must be in the range [0..$length)"; | |
| 2552 throw new RangeError(message); | |
| 2553 } | |
| 2554 _typeddata.setFloat32x4(offsetInBytes + | |
| 2555 (index * Float32x4List.BYTES_PER_ELEMENT), value); | |
| 2556 } | |
| 2557 | |
| 2558 Iterator<Float32x4> get iterator { | |
| 2559 return new _TypedListIterator<Float32x4>(this); | |
| 2560 } | |
| 2561 | |
| 2562 | |
| 2563 // Method(s) implementing TypedData interface. | |
| 2564 | |
| 2565 int get elementSizeInBytes { | |
| 2566 return Float32x4List.BYTES_PER_ELEMENT; | |
| 2567 } | |
| 2568 } | |
| 2569 | |
| 2570 | |
| 2227 class _ByteDataView implements ByteData { | 2571 class _ByteDataView implements ByteData { |
| 2228 _ByteDataView(ByteBuffer _buffer, int _offsetInBytes, int _lengthInBytes) | 2572 _ByteDataView(ByteBuffer _buffer, int _offsetInBytes, int _lengthInBytes) |
| 2229 : _typeddata = _buffer as TypedData, | 2573 : _typeddata = _buffer as TypedData, |
| 2230 _offset = _offsetInBytes, | 2574 _offset = _offsetInBytes, |
| 2231 _length = _lengthInBytes { | 2575 _length = _lengthInBytes { |
| 2232 _rangeCheck(_buffer.lengthInBytes, _offset, _length); | 2576 _rangeCheck(_buffer.lengthInBytes, _offset, _length); |
| 2233 } | 2577 } |
| 2234 | 2578 |
| 2235 | 2579 |
| 2236 // Method(s) implementing TypedData interface. | 2580 // Method(s) implementing TypedData interface. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2281 return _typeddata._getInt32(_offset + byteOffset); | 2625 return _typeddata._getInt32(_offset + byteOffset); |
| 2282 } | 2626 } |
| 2283 void setInt32(int byteOffset, int value) { | 2627 void setInt32(int byteOffset, int value) { |
| 2284 _typeddata._setInt32(_offset + byteOffset, value); | 2628 _typeddata._setInt32(_offset + byteOffset, value); |
| 2285 } | 2629 } |
| 2286 | 2630 |
| 2287 int getUint32(int byteOffset) { | 2631 int getUint32(int byteOffset) { |
| 2288 return _typeddata._getUint32(_offset + byteOffset); | 2632 return _typeddata._getUint32(_offset + byteOffset); |
| 2289 } | 2633 } |
| 2290 void setUint32(int byteOffset, int value) { | 2634 void setUint32(int byteOffset, int value) { |
| 2291 _typedata._setUint32(_offset + byteOffset, value); | 2635 _typeddata._setUint32(_offset + byteOffset, value); |
| 2292 } | 2636 } |
| 2293 | 2637 |
| 2294 int getInt64(int byteOffset) { | 2638 int getInt64(int byteOffset) { |
| 2295 return _typedata._getInt64(_offset + byteOffset); | 2639 return _typeddata._getInt64(_offset + byteOffset); |
| 2296 } | 2640 } |
| 2297 void setInt64(int byteOffset, int value) { | 2641 void setInt64(int byteOffset, int value) { |
| 2298 _typedata._setInt64(_offset + byteOffset, value); | 2642 _typeddata._setInt64(_offset + byteOffset, value); |
| 2299 } | 2643 } |
| 2300 | 2644 |
| 2301 int getUint64(int byteOffset) { | 2645 int getUint64(int byteOffset) { |
| 2302 return _typedata._getUint64(_offset + byteOffset); | 2646 return _typeddata._getUint64(_offset + byteOffset); |
| 2303 } | 2647 } |
| 2304 void setUint64(int byteOffset, int value) { | 2648 void setUint64(int byteOffset, int value) { |
| 2305 _typedata._setUint64(_offset + byteOffset, value); | 2649 _typeddata._setUint64(_offset + byteOffset, value); |
| 2306 } | 2650 } |
| 2307 | 2651 |
| 2308 double getFloat32(int byteOffset) { | 2652 double getFloat32(int byteOffset) { |
| 2309 return _typedata._getFloat32(_offset + byteOffset); | 2653 return _typeddata._getFloat32(_offset + byteOffset); |
| 2310 } | 2654 } |
| 2311 void setFloat32(int byteOffset, double value) { | 2655 void setFloat32(int byteOffset, double value) { |
| 2312 _typedata._setFloat32(_offset + byteOffset, value); | 2656 _typeddata._setFloat32(_offset + byteOffset, value); |
| 2313 } | 2657 } |
| 2314 | 2658 |
| 2315 double getFloat64(int byteOffset) { | 2659 double getFloat64(int byteOffset) { |
| 2316 return _typedata._getFloat64(_offset + byteOffset); | 2660 return _typeddata._getFloat64(_offset + byteOffset); |
| 2317 } | 2661 } |
| 2318 void setFloat64(int byteOffset, double value) { | 2662 void setFloat64(int byteOffset, double value) { |
| 2319 _typedata._setFloat64(_offset + byteOffset, value); | 2663 _typeddata._setFloat64(_offset + byteOffset, value); |
| 2664 } | |
|
siva
2013/03/12 11:44:22
Thanks for fixing these.
| |
| 2665 | |
| 2666 Float32x4 getFloat32x4(int byteOffset) { | |
| 2667 return _typeddata._getFloat32x4(_offset + byteOffset); | |
| 2668 } | |
| 2669 void setFloat32x4(int byteOffset, Float32x4 value) { | |
| 2670 _typeddata._setFloat32x4(_offset + byteOffset, value); | |
| 2320 } | 2671 } |
| 2321 | 2672 |
| 2322 final TypedData _typeddata; | 2673 final TypedData _typeddata; |
| 2323 final int _offset; | 2674 final int _offset; |
| 2324 final int _length; | 2675 final int _length; |
| 2325 } | 2676 } |
| 2326 | 2677 |
| 2327 | 2678 |
| 2328 // Top level utility methods. | 2679 // Top level utility methods. |
| 2329 int _toInt(int value, int mask) { | 2680 int _toInt(int value, int mask) { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2391 throw new RangeError.value(start + length); | 2742 throw new RangeError.value(start + length); |
| 2392 } | 2743 } |
| 2393 } | 2744 } |
| 2394 | 2745 |
| 2395 | 2746 |
| 2396 int _defaultIfNull(object, value) { | 2747 int _defaultIfNull(object, value) { |
| 2397 if (object == null) { | 2748 if (object == null) { |
| 2398 return value; | 2749 return value; |
| 2399 } | 2750 } |
| 2400 } | 2751 } |
| OLD | NEW |