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 library dart.typed_data; |
6 | 6 |
7 import "dart:_internal"; | 7 import "dart:_internal"; |
| 8 import "dart:collection" show ListBase; |
8 import 'dart:math' show Random; | 9 import 'dart:math' show Random; |
9 | 10 |
10 patch class Int8List { | 11 /** |
11 /* patch */ factory Int8List(int length) { | 12 * A typed view of a sequence of bytes. |
12 return new _Int8Array(length); | 13 */ |
13 } | 14 abstract class TypedData { |
14 | 15 /** |
15 /* patch */ factory Int8List.fromList(List<int> elements) { | 16 * Returns the number of bytes in the representation of each element in this |
16 return new _Int8Array(elements.length) | 17 * list. |
17 ..setRange(0, elements.length, elements); | 18 */ |
18 } | 19 int get elementSizeInBytes; |
| 20 |
| 21 /** |
| 22 * Returns the offset in bytes into the underlying byte buffer of this view. |
| 23 */ |
| 24 int get offsetInBytes; |
| 25 |
| 26 /** |
| 27 * Returns the length of this view, in bytes. |
| 28 */ |
| 29 int get lengthInBytes; |
| 30 |
| 31 /** |
| 32 * Returns the byte buffer associated with this object. |
| 33 */ |
| 34 ByteBuffer get buffer; |
19 } | 35 } |
20 | 36 |
21 | 37 |
22 patch class Uint8List { | 38 /** |
23 /* patch */ factory Uint8List(int length) { | 39 * Describes endianness to be used when accessing or updating a |
24 return new _Uint8Array(length); | 40 * sequence of bytes. |
25 } | 41 */ |
26 | 42 class Endianness { |
27 /* patch */ factory Uint8List.fromList(List<int> elements) { | 43 const Endianness._(this._littleEndian); |
28 return new _Uint8Array(elements.length) | 44 |
29 ..setRange(0, elements.length, elements); | 45 static const Endianness BIG_ENDIAN = const Endianness._(false); |
30 } | 46 static const Endianness LITTLE_ENDIAN = const Endianness._(true); |
| 47 static final Endianness HOST_ENDIAN = |
| 48 (new ByteData.view(new Uint16List.fromList([1]).buffer)).getInt8(0) == 1 ? |
| 49 LITTLE_ENDIAN : BIG_ENDIAN; |
| 50 |
| 51 final bool _littleEndian; |
31 } | 52 } |
32 | 53 |
33 | 54 |
34 patch class Uint8ClampedList { | 55 /** |
35 /* patch */ factory Uint8ClampedList(int length) { | 56 * A fixed-length, random-access sequence of bytes that also provides random |
36 return new _Uint8ClampedArray(length); | 57 * and unaligned access to the fixed-width integers and floating point |
37 } | 58 * numbers represented by those bytes. |
38 | 59 * |
39 /* patch */ factory Uint8ClampedList.fromList(List<int> elements) { | 60 * `ByteData` may be used to pack and unpack data from external sources |
40 return new _Uint8ClampedArray(elements.length) | 61 * (such as networks or files systems), and to process large quantities |
41 ..setRange(0, elements.length, elements); | 62 * of numerical data more efficiently than would be possible |
42 } | 63 * with ordinary [List] implementations. |
43 } | 64 * `ByteData` can save space, by eliminating the need for object headers, |
44 | 65 * and time, by eliminating the need for data copies. |
45 | 66 * Finally, `ByteData` may be used to intentionally reinterpret the bytes |
46 patch class Int16List { | 67 * representing one arithmetic type as another. |
47 /* patch */ factory Int16List(int length) { | 68 * For example this code fragment determine what 32-bit signed integer |
48 return new _Int16Array(length); | 69 * is represented by the bytes of a 32-bit floating point number: |
49 } | 70 * |
50 | 71 * var buffer = new Uint8List(8).buffer; |
51 /* patch */ factory Int16List.fromList(List<int> elements) { | 72 * var bdata = new ByteData.view(buffer); |
52 return new _Int16Array(elements.length) | 73 * bdata.setFloat32(0, 3.04); |
53 ..setRange(0, elements.length, elements); | 74 * int huh = bdata.getInt32(0); |
54 } | 75 */ |
55 } | 76 class ByteData implements TypedData { |
56 | 77 /** |
57 | 78 * Creates a [ByteData] of the specified length (in elements), all of |
58 patch class Uint16List { | 79 * whose bytes are initially zero. |
59 /* patch */ factory Uint16List(int length) { | 80 */ |
60 return new _Uint16Array(length); | 81 factory ByteData(int length) { |
61 } | 82 var list = new Uint8List(length); |
62 | |
63 /* patch */ factory Uint16List.fromList(List<int> elements) { | |
64 return new _Uint16Array(elements.length) | |
65 ..setRange(0, elements.length, elements); | |
66 } | |
67 } | |
68 | |
69 | |
70 patch class Int32List { | |
71 /* patch */ factory Int32List(int length) { | |
72 return new _Int32Array(length); | |
73 } | |
74 | |
75 /* patch */ factory Int32List.fromList(List<int> elements) { | |
76 return new _Int32Array(elements.length) | |
77 ..setRange(0, elements.length, elements); | |
78 } | |
79 } | |
80 | |
81 | |
82 patch class Uint32List { | |
83 /* patch */ factory Uint32List(int length) { | |
84 return new _Uint32Array(length); | |
85 } | |
86 | |
87 /* patch */ factory Uint32List.fromList(List<int> elements) { | |
88 return new _Uint32Array(elements.length) | |
89 ..setRange(0, elements.length, elements); | |
90 } | |
91 } | |
92 | |
93 | |
94 patch class Int64List { | |
95 /* patch */ factory Int64List(int length) { | |
96 return new _Int64Array(length); | |
97 } | |
98 | |
99 /* patch */ factory Int64List.fromList(List<int> elements) { | |
100 return new _Int64Array(elements.length) | |
101 ..setRange(0, elements.length, elements); | |
102 } | |
103 } | |
104 | |
105 | |
106 patch class Uint64List { | |
107 /* patch */ factory Uint64List(int length) { | |
108 return new _Uint64Array(length); | |
109 } | |
110 | |
111 /* patch */ factory Uint64List.fromList(List<int> elements) { | |
112 return new _Uint64Array(elements.length) | |
113 ..setRange(0, elements.length, elements); | |
114 } | |
115 } | |
116 | |
117 | |
118 patch class Float32List { | |
119 /* patch */ factory Float32List(int length) { | |
120 return new _Float32Array(length); | |
121 } | |
122 | |
123 /* patch */ factory Float32List.fromList(List<double> elements) { | |
124 return new _Float32Array(elements.length) | |
125 ..setRange(0, elements.length, elements); | |
126 } | |
127 } | |
128 | |
129 | |
130 patch class Float64List { | |
131 /* patch */ factory Float64List(int length) { | |
132 return new _Float64Array(length); | |
133 } | |
134 | |
135 /* patch */ factory Float64List.fromList(List<double> elements) { | |
136 return new _Float64Array(elements.length) | |
137 ..setRange(0, elements.length, elements); | |
138 } | |
139 } | |
140 | |
141 | |
142 patch class Float32x4List { | |
143 /* patch */ factory Float32x4List(int length) { | |
144 return new _Float32x4Array(length); | |
145 } | |
146 | |
147 /* patch */ factory Float32x4List.fromList(List<Float32x4> elements) { | |
148 return new _Float32x4Array(elements.length) | |
149 ..setRange(0, elements.length, elements); | |
150 } | |
151 } | |
152 | |
153 | |
154 patch class Int32x4List { | |
155 /* patch */ factory Int32x4List(int length) { | |
156 return new _Int32x4Array(length); | |
157 } | |
158 | |
159 /* patch */ factory Int32x4List.fromList(List<Int32x4> elements) { | |
160 return new _Int32x4Array(elements.length) | |
161 ..setRange(0, elements.length, elements); | |
162 } | |
163 | |
164 } | |
165 | |
166 patch class Float64x2List { | |
167 /* patch */ factory Float64x2List(int length) { | |
168 return new _Float64x2Array(length); | |
169 } | |
170 | |
171 /* patch */ factory Float64x2List.fromList(List<Float64x2> elements) { | |
172 return new _Float64x2Array(elements.length) | |
173 ..setRange(0, elements.length, elements); | |
174 } | |
175 } | |
176 | |
177 | |
178 patch class Float32x4 { | |
179 /* patch */ factory Float32x4(double x, double y, double z, double w) { | |
180 return new _Float32x4(x, y, z, w); | |
181 } | |
182 /* patch */ factory Float32x4.splat(double v) { | |
183 return new _Float32x4.splat(v); | |
184 } | |
185 /* patch */ factory Float32x4.zero() { | |
186 return new _Float32x4.zero(); | |
187 } | |
188 /* patch */ factory Float32x4.fromInt32x4Bits(Int32x4 x) { | |
189 return new _Float32x4.fromInt32x4Bits(x); | |
190 } | |
191 /* patch */ factory Float32x4.fromFloat64x2(Float64x2 v) { | |
192 return new _Float32x4.fromFloat64x2(v); | |
193 } | |
194 } | |
195 | |
196 | |
197 patch class Int32x4 { | |
198 /* patch */ factory Int32x4(int x, int y, int z, int w) { | |
199 return new _Int32x4(x, y, z, w); | |
200 } | |
201 /* patch */ factory Int32x4.bool(bool x, bool y, bool z, bool w) { | |
202 return new _Int32x4.bool(x, y, z, w); | |
203 } | |
204 /* patch */ factory Int32x4.fromFloat32x4Bits(Float32x4 x) { | |
205 return new _Int32x4.fromFloat32x4Bits(x); | |
206 } | |
207 } | |
208 | |
209 | |
210 patch class Float64x2 { | |
211 /* patch */ factory Float64x2(double x, double y) { | |
212 return new _Float64x2(x, y); | |
213 } | |
214 | |
215 /* patch */ factory Float64x2.splat(double v) { | |
216 return new _Float64x2.splat(v); | |
217 } | |
218 | |
219 /* patch */ factory Float64x2.zero() { | |
220 return new _Float64x2.zero(); | |
221 } | |
222 | |
223 /* patch */ factory Float64x2.fromFloat32x4(Float32x4 v) { | |
224 return new _Float64x2.fromFloat32x4(v); | |
225 } | |
226 } | |
227 | |
228 | |
229 patch class ByteData { | |
230 /* patch */ factory ByteData(int length) { | |
231 var list = new _Uint8Array(length); | |
232 return new _ByteDataView(list, 0, length); | 83 return new _ByteDataView(list, 0, length); |
233 } | 84 } |
234 | 85 |
235 // Called directly from C code. | 86 // Called directly from C code. |
236 factory ByteData._view(TypedData typedData, int offsetInBytes, int length) { | 87 factory ByteData._view(TypedData typedData, int offsetInBytes, int length) { |
237 return new _ByteDataView(typedData, offsetInBytes, length); | 88 return new _ByteDataView(typedData, offsetInBytes, length); |
238 } | 89 } |
| 90 |
| 91 /** |
| 92 * Creates an [ByteData] _view_ of the specified region in [buffer]. |
| 93 * |
| 94 * Changes in the [ByteData] will be visible in the byte |
| 95 * buffer and vice versa. |
| 96 * If the [offsetInBytes] index of the region is not specified, |
| 97 * it defaults to zero (the first byte in the byte buffer). |
| 98 * If the length is not specified, it defaults to `null`, |
| 99 * which indicates that the view extends to the end of the byte buffer. |
| 100 * |
| 101 * Throws [RangeError] if [offsetInBytes] or [length] are negative, or |
| 102 * if [offsetInBytes] + ([length] * elementSizeInBytes) is greater than |
| 103 * the length of [buffer]. |
| 104 */ |
| 105 factory ByteData.view(ByteBuffer buffer, |
| 106 [int offsetInBytes = 0, int length]) { |
| 107 return buffer.asByteData(offsetInBytes, length); |
| 108 } |
| 109 |
| 110 /** |
| 111 * Returns the (possibly negative) integer represented by the byte at the |
| 112 * specified [byteOffset] in this object, in two's complement binary |
| 113 * representation. |
| 114 * |
| 115 * The return value will be between -128 and 127, inclusive. |
| 116 * |
| 117 * Throws [RangeError] if [byteOffset] is negative, or |
| 118 * greater than or equal to the length of this object. |
| 119 */ |
| 120 int getInt8(int byteOffset); |
| 121 |
| 122 /** |
| 123 * Sets the byte at the specified [byteOffset] in this object to the |
| 124 * two's complement binary representation of the specified [value], which |
| 125 * must fit in a single byte. |
| 126 * |
| 127 * In other words, [value] must be between -128 and 127, inclusive. |
| 128 * |
| 129 * Throws [RangeError] if [byteOffset] is negative, or |
| 130 * greater than or equal to the length of this object. |
| 131 */ |
| 132 void setInt8(int byteOffset, int value); |
| 133 |
| 134 /** |
| 135 * Returns the positive integer represented by the byte at the specified |
| 136 * [byteOffset] in this object, in unsigned binary form. |
| 137 * |
| 138 * The return value will be between 0 and 255, inclusive. |
| 139 * |
| 140 * Throws [RangeError] if [byteOffset] is negative, or |
| 141 * greater than or equal to the length of this object. |
| 142 */ |
| 143 int getUint8(int byteOffset); |
| 144 |
| 145 /** |
| 146 * Sets the byte at the specified [byteOffset] in this object to the |
| 147 * unsigned binary representation of the specified [value], which must fit |
| 148 * in a single byte. |
| 149 * |
| 150 * In other words, [value] must be between 0 and 255, inclusive. |
| 151 * |
| 152 * Throws [RangeError] if [byteOffset] is negative, |
| 153 * or greater than or equal to the length of this object. |
| 154 */ |
| 155 void setUint8(int byteOffset, int value); |
| 156 |
| 157 /** |
| 158 * Returns the (possibly negative) integer represented by the two bytes at |
| 159 * the specified [byteOffset] in this object, in two's complement binary |
| 160 * form. |
| 161 * |
| 162 * The return value will be between 2<sup>15</sup> and 2<sup>15</sup> - 1, |
| 163 * inclusive. |
| 164 * |
| 165 * Throws [RangeError] if [byteOffset] is negative, or |
| 166 * `byteOffset + 2` is greater than the length of this object. |
| 167 */ |
| 168 int getInt16(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]); |
| 169 |
| 170 /** |
| 171 * Sets the two bytes starting at the specified [byteOffset] in this |
| 172 * object to the two's complement binary representation of the specified |
| 173 * [value], which must fit in two bytes. |
| 174 * |
| 175 * In other words, [value] must lie |
| 176 * between 2<sup>15</sup> and 2<sup>15</sup> - 1, inclusive. |
| 177 * |
| 178 * Throws [RangeError] if [byteOffset] is negative, or |
| 179 * `byteOffset + 2` is greater than the length of this object. |
| 180 */ |
| 181 void setInt16(int byteOffset, |
| 182 int value, |
| 183 [Endianness endian = Endianness.BIG_ENDIAN]); |
| 184 |
| 185 /** |
| 186 * Returns the positive integer represented by the two bytes starting |
| 187 * at the specified [byteOffset] in this object, in unsigned binary |
| 188 * form. |
| 189 * |
| 190 * The return value will be between 0 and 2<sup>16</sup> - 1, inclusive. |
| 191 * |
| 192 * Throws [RangeError] if [byteOffset] is negative, or |
| 193 * `byteOffset + 2` is greater than the length of this object. |
| 194 */ |
| 195 int getUint16(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]); |
| 196 |
| 197 /** |
| 198 * Sets the two bytes starting at the specified [byteOffset] in this object |
| 199 * to the unsigned binary representation of the specified [value], |
| 200 * which must fit in two bytes. |
| 201 * |
| 202 * In other words, [value] must be between |
| 203 * 0 and 2<sup>16</sup> - 1, inclusive. |
| 204 * |
| 205 * Throws [RangeError] if [byteOffset] is negative, or |
| 206 * `byteOffset + 2` is greater than the length of this object. |
| 207 */ |
| 208 void setUint16(int byteOffset, |
| 209 int value, |
| 210 [Endianness endian = Endianness.BIG_ENDIAN]); |
| 211 |
| 212 /** |
| 213 * Returns the (possibly negative) integer represented by the four bytes at |
| 214 * the specified [byteOffset] in this object, in two's complement binary |
| 215 * form. |
| 216 * |
| 217 * The return value will be between 2<sup>31</sup> and 2<sup>31</sup> - 1, |
| 218 * inclusive. |
| 219 * |
| 220 * Throws [RangeError] if [byteOffset] is negative, or |
| 221 * `byteOffset + 4` is greater than the length of this object. |
| 222 */ |
| 223 int getInt32(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]); |
| 224 |
| 225 /** |
| 226 * Sets the four bytes starting at the specified [byteOffset] in this |
| 227 * object to the two's complement binary representation of the specified |
| 228 * [value], which must fit in four bytes. |
| 229 * |
| 230 * In other words, [value] must lie |
| 231 * between 2<sup>31</sup> and 2<sup>31</sup> - 1, inclusive. |
| 232 * |
| 233 * Throws [RangeError] if [byteOffset] is negative, or |
| 234 * `byteOffset + 4` is greater than the length of this object. |
| 235 */ |
| 236 void setInt32(int byteOffset, |
| 237 int value, |
| 238 [Endianness endian = Endianness.BIG_ENDIAN]); |
| 239 |
| 240 /** |
| 241 * Returns the positive integer represented by the four bytes starting |
| 242 * at the specified [byteOffset] in this object, in unsigned binary |
| 243 * form. |
| 244 * |
| 245 * The return value will be between 0 and 2<sup>32</sup> - 1, inclusive. |
| 246 * |
| 247 * Throws [RangeError] if [byteOffset] is negative, or |
| 248 * `byteOffset + 4` is greater than the length of this object. |
| 249 */ |
| 250 int getUint32(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]); |
| 251 |
| 252 /** |
| 253 * Sets the four bytes starting at the specified [byteOffset] in this object |
| 254 * to the unsigned binary representation of the specified [value], |
| 255 * which must fit in four bytes. |
| 256 * |
| 257 * In other words, [value] must be between |
| 258 * 0 and 2<sup>32</sup> - 1, inclusive. |
| 259 * |
| 260 * Throws [RangeError] if [byteOffset] is negative, or |
| 261 * `byteOffset + 4` is greater than the length of this object. |
| 262 */ |
| 263 void setUint32(int byteOffset, |
| 264 int value, |
| 265 [Endianness endian = Endianness.BIG_ENDIAN]); |
| 266 |
| 267 /** |
| 268 * Returns the (possibly negative) integer represented by the eight bytes at |
| 269 * the specified [byteOffset] in this object, in two's complement binary |
| 270 * form. |
| 271 * |
| 272 * The return value will be between 2<sup>63</sup> and 2<sup>63</sup> - 1, |
| 273 * inclusive. |
| 274 * |
| 275 * Throws [RangeError] if [byteOffset] is negative, or |
| 276 * `byteOffset + 8` is greater than the length of this object. |
| 277 */ |
| 278 int getInt64(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]); |
| 279 |
| 280 /** |
| 281 * Sets the eight bytes starting at the specified [byteOffset] in this |
| 282 * object to the two's complement binary representation of the specified |
| 283 * [value], which must fit in eight bytes. |
| 284 * |
| 285 * In other words, [value] must lie |
| 286 * between 2<sup>63</sup> and 2<sup>63</sup> - 1, inclusive. |
| 287 * |
| 288 * Throws [RangeError] if [byteOffset] is negative, or |
| 289 * `byteOffset + 8` is greater than the length of this object. |
| 290 */ |
| 291 void setInt64(int byteOffset, |
| 292 int value, |
| 293 [Endianness endian = Endianness.BIG_ENDIAN]); |
| 294 |
| 295 /** |
| 296 * Returns the positive integer represented by the eight bytes starting |
| 297 * at the specified [byteOffset] in this object, in unsigned binary |
| 298 * form. |
| 299 * |
| 300 * The return value will be between 0 and 2<sup>64</sup> - 1, inclusive. |
| 301 * |
| 302 * Throws [RangeError] if [byteOffset] is negative, or |
| 303 * `byteOffset + 8` is greater than the length of this object. |
| 304 */ |
| 305 int getUint64(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]); |
| 306 |
| 307 /** |
| 308 * Sets the eight bytes starting at the specified [byteOffset] in this object |
| 309 * to the unsigned binary representation of the specified [value], |
| 310 * which must fit in eight bytes. |
| 311 * |
| 312 * In other words, [value] must be between |
| 313 * 0 and 2<sup>64</sup> - 1, inclusive. |
| 314 * |
| 315 * Throws [RangeError] if [byteOffset] is negative, or |
| 316 * `byteOffset + 8` is greater than the length of this object. |
| 317 */ |
| 318 void setUint64(int byteOffset, |
| 319 int value, |
| 320 [Endianness endian = Endianness.BIG_ENDIAN]); |
| 321 |
| 322 /** |
| 323 * Returns the floating point number represented by the four bytes at |
| 324 * the specified [byteOffset] in this object, in IEEE 754 |
| 325 * single-precision binary floating-point format (binary32). |
| 326 * |
| 327 * Throws [RangeError] if [byteOffset] is negative, or |
| 328 * `byteOffset + 4` is greater than the length of this object. |
| 329 */ |
| 330 double getFloat32(int byteOffset, |
| 331 [Endianness endian = Endianness.BIG_ENDIAN]); |
| 332 |
| 333 /** |
| 334 * Sets the four bytes starting at the specified [byteOffset] in this |
| 335 * object to the IEEE 754 single-precision binary floating-point |
| 336 * (binary32) representation of the specified [value]. |
| 337 * |
| 338 * **Note that this method can lose precision.** The input [value] is |
| 339 * a 64-bit floating point value, which will be converted to 32-bit |
| 340 * floating point value by IEEE 754 rounding rules before it is stored. |
| 341 * If [value] cannot be represented exactly as a binary32, it will be |
| 342 * converted to the nearest binary32 value. If two binary32 values are |
| 343 * equally close, the one whose least significant bit is zero will be used. |
| 344 * Note that finite (but large) values can be converted to infinity, and |
| 345 * small non-zero values can be converted to zero. |
| 346 * |
| 347 * Throws [RangeError] if [byteOffset] is negative, or |
| 348 * `byteOffset + 4` is greater than the length of this object. |
| 349 */ |
| 350 void setFloat32(int byteOffset, |
| 351 double value, |
| 352 [Endianness endian = Endianness.BIG_ENDIAN]); |
| 353 |
| 354 /** |
| 355 * Returns the floating point number represented by the eight bytes at |
| 356 * the specified [byteOffset] in this object, in IEEE 754 |
| 357 * double-precision binary floating-point format (binary64). |
| 358 * |
| 359 * Throws [RangeError] if [byteOffset] is negative, or |
| 360 * `byteOffset + 8` is greater than the length of this object. |
| 361 */ |
| 362 double getFloat64(int byteOffset, |
| 363 [Endianness endian = Endianness.BIG_ENDIAN]); |
| 364 |
| 365 /** |
| 366 * Sets the eight bytes starting at the specified [byteOffset] in this |
| 367 * object to the IEEE 754 double-precision binary floating-point |
| 368 * (binary64) representation of the specified [value]. |
| 369 * |
| 370 * Throws [RangeError] if [byteOffset] is negative, or |
| 371 * `byteOffset + 8` is greater than the length of this object. |
| 372 */ |
| 373 void setFloat64(int byteOffset, |
| 374 double value, |
| 375 [Endianness endian = Endianness.BIG_ENDIAN]); |
239 } | 376 } |
240 | 377 |
241 | 378 |
242 // Based class for _TypedList that provides common methods for implementing | 379 // Based class for _TypedList that provides common methods for implementing |
243 // the collection and list interfaces. | 380 // the collection and list interfaces. |
244 // This class does not extend ListBase<T> since that would add type arguments | 381 // This class does not extend ListBase<T> since that would add type arguments |
245 // to instances of _TypeListBase. Instead the subclasses use type specific | 382 // to instances of _TypeListBase. Instead the subclasses use type specific |
246 // mixins (like _IntListMixin, _DoubleListMixin) to implement ListBase<T>. | 383 // mixins (like _IntListMixin, _DoubleListMixin) to implement ListBase<T>. |
247 abstract class _TypedListBase { | 384 abstract class _TypedListBase { |
248 | 385 |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 | 841 |
705 Iterable<Float64x2> getRange(int start, [int end]) { | 842 Iterable<Float64x2> getRange(int start, [int end]) { |
706 RangeError.checkValidRange(start, end, this.length); | 843 RangeError.checkValidRange(start, end, this.length); |
707 return new SubListIterable<Float64x2>(this, start, end); | 844 return new SubListIterable<Float64x2>(this, start, end); |
708 } | 845 } |
709 | 846 |
710 Iterator<Float64x2> get iterator => new _TypedListIterator<Float64x2>(this); | 847 Iterator<Float64x2> get iterator => new _TypedListIterator<Float64x2>(this); |
711 } | 848 } |
712 | 849 |
713 | 850 |
714 class _ByteBuffer implements ByteBuffer { | 851 class ByteBuffer { |
715 final _TypedList _data; | 852 final _TypedList _data; |
716 | 853 |
717 _ByteBuffer(this._data); | 854 ByteBuffer(this._data); |
718 | 855 |
719 factory _ByteBuffer._New(data) => new _ByteBuffer(data); | 856 factory ByteBuffer._New(data) => new ByteBuffer(data); |
720 | 857 |
721 // Forward calls to _data. | 858 // Forward calls to _data. |
722 int get lengthInBytes => _data.lengthInBytes; | 859 int get lengthInBytes => _data.lengthInBytes; |
723 int get hashCode => _data.hashCode; | 860 int get hashCode => _data.hashCode; |
724 bool operator==(Object other) => | 861 bool operator==(Object other) => |
725 (other is _ByteBuffer) && identical(_data, other._data); | 862 (other is ByteBuffer) && identical(_data, other._data); |
726 | 863 |
727 ByteData asByteData([int offsetInBytes = 0, int length]) { | 864 ByteData asByteData([int offsetInBytes = 0, int length]) { |
728 if (length == null) { | 865 if (length == null) { |
729 length = this.lengthInBytes - offsetInBytes; | 866 length = this.lengthInBytes - offsetInBytes; |
730 } | 867 } |
731 return new _ByteDataView(this._data, offsetInBytes, length); | 868 return new _ByteDataView(this._data, offsetInBytes, length); |
732 } | 869 } |
733 | 870 |
734 Int8List asInt8List([int offsetInBytes = 0, int length]) { | 871 Int8List asInt8List([int offsetInBytes = 0, int length]) { |
735 if (length == null) { | 872 if (length == null) { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 abstract class _TypedList extends _TypedListBase { | 982 abstract class _TypedList extends _TypedListBase { |
846 // Default method implementing parts of the TypedData interface. | 983 // Default method implementing parts of the TypedData interface. |
847 int get offsetInBytes { | 984 int get offsetInBytes { |
848 return 0; | 985 return 0; |
849 } | 986 } |
850 | 987 |
851 int get lengthInBytes { | 988 int get lengthInBytes { |
852 return length * elementSizeInBytes; | 989 return length * elementSizeInBytes; |
853 } | 990 } |
854 | 991 |
855 ByteBuffer get buffer => new _ByteBuffer(this); | 992 ByteBuffer get buffer => new ByteBuffer(this); |
856 | 993 |
857 // Methods implementing the collection interface. | 994 // Methods implementing the collection interface. |
858 | 995 |
859 int get length native "TypedData_length"; | 996 int get length native "TypedData_length"; |
860 | 997 |
861 // Internal utility methods. | 998 // Internal utility methods. |
862 | 999 |
863 int _getInt8(int offsetInBytes) native "TypedData_GetInt8"; | 1000 int _getInt8(int offsetInBytes) native "TypedData_GetInt8"; |
864 void _setInt8(int offsetInBytes, int value) native "TypedData_SetInt8"; | 1001 void _setInt8(int offsetInBytes, int value) native "TypedData_SetInt8"; |
865 | 1002 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
917 string.length, | 1054 string.length, |
918 "skipCount", "skipCount + length"); | 1055 "skipCount", "skipCount + length"); |
919 for (int i = 0; i < length; i++) { | 1056 for (int i = 0; i < length; i++) { |
920 _setUint16(byteStart + i * Uint16List.BYTES_PER_ELEMENT, | 1057 _setUint16(byteStart + i * Uint16List.BYTES_PER_ELEMENT, |
921 string.codeUnitAt(skipCount + i)); | 1058 string.codeUnitAt(skipCount + i)); |
922 } | 1059 } |
923 } | 1060 } |
924 } | 1061 } |
925 | 1062 |
926 | 1063 |
927 class _Int8Array extends _TypedList with _IntListMixin implements Int8List { | 1064 class Int8List extends _TypedList with _IntListMixin implements List<int>, Typed
Data { |
928 // Factory constructors. | 1065 // Factory constructors. |
929 | 1066 |
930 factory _Int8Array(int length) native "TypedData_Int8Array_new"; | 1067 factory Int8List(int length) native "TypedData_Int8Array_new"; |
| 1068 |
| 1069 factory Int8List.fromList(List<int> elements) { |
| 1070 return new Int8List(elements.length) |
| 1071 ..setRange(0, elements.length, elements); |
| 1072 } |
| 1073 |
| 1074 factory Int8List.view(ByteBuffer buffer, |
| 1075 [int offsetInBytes = 0, int length]) { |
| 1076 return buffer.asInt8List(offsetInBytes, length); |
| 1077 } |
931 | 1078 |
932 // Method(s) implementing List interface. | 1079 // Method(s) implementing List interface. |
933 | 1080 |
934 int operator[](int index) { | 1081 int operator[](int index) { |
935 if (index < 0 || index >= length) { | 1082 if (index < 0 || index >= length) { |
936 throw new RangeError.index(index, this, "index"); | 1083 throw new RangeError.index(index, this, "index"); |
937 } | 1084 } |
938 return _getInt8(index); | 1085 return _getInt8(index); |
939 } | 1086 } |
940 | 1087 |
941 void operator[]=(int index, int value) { | 1088 void operator[]=(int index, int value) { |
942 if (index < 0 || index >= length) { | 1089 if (index < 0 || index >= length) { |
943 throw new RangeError.index(index, this, "index"); | 1090 throw new RangeError.index(index, this, "index"); |
944 } | 1091 } |
945 _setInt8(index, _toInt8(value)); | 1092 _setInt8(index, _toInt8(value)); |
946 } | 1093 } |
947 | 1094 |
| 1095 static const int BYTES_PER_ELEMENT = 1; |
948 | 1096 |
949 // Method(s) implementing TypedData interface. | 1097 // Method(s) implementing TypedData interface. |
950 | 1098 |
951 int get elementSizeInBytes { | 1099 int get elementSizeInBytes { |
952 return Int8List.BYTES_PER_ELEMENT; | 1100 return Int8List.BYTES_PER_ELEMENT; |
953 } | 1101 } |
954 | 1102 |
955 | 1103 |
956 // Internal utility methods. | 1104 // Internal utility methods. |
957 | 1105 |
958 _Int8Array _createList(int length) { | 1106 Int8List _createList(int length) { |
959 return new _Int8Array(length); | 1107 return new Int8List(length); |
960 } | 1108 } |
961 } | 1109 } |
962 | 1110 |
963 | 1111 |
964 class _Uint8Array extends _TypedList with _IntListMixin implements Uint8List { | 1112 class Uint8List extends _TypedList with _IntListMixin implements List<int>, Type
dData { |
965 // Factory constructors. | 1113 // Factory constructors. |
966 | 1114 |
967 factory _Uint8Array(int length) native "TypedData_Uint8Array_new"; | 1115 factory Uint8List(int length) native "TypedData_Uint8Array_new"; |
| 1116 |
| 1117 factory Uint8List.fromList(List<int> elements) { |
| 1118 return new Uint8List(elements.length) |
| 1119 ..setRange(0, elements.length, elements); |
| 1120 } |
| 1121 |
| 1122 factory Uint8List.view(ByteBuffer buffer, |
| 1123 [int offsetInBytes = 0, int length]) { |
| 1124 return buffer.asUint8List(offsetInBytes, length); |
| 1125 } |
968 | 1126 |
969 // Methods implementing List interface. | 1127 // Methods implementing List interface. |
970 int operator[](int index) { | 1128 int operator[](int index) { |
971 if (index < 0 || index >= length) { | 1129 if (index < 0 || index >= length) { |
972 throw new RangeError.index(index, this, "index"); | 1130 throw new RangeError.index(index, this, "index"); |
973 } | 1131 } |
974 return _getUint8(index); | 1132 return _getUint8(index); |
975 } | 1133 } |
976 | 1134 |
977 void operator[]=(int index, int value) { | 1135 void operator[]=(int index, int value) { |
978 if (index < 0 || index >= length) { | 1136 if (index < 0 || index >= length) { |
979 throw new RangeError.index(index, this, "index"); | 1137 throw new RangeError.index(index, this, "index"); |
980 } | 1138 } |
981 _setUint8(index, _toUint8(value)); | 1139 _setUint8(index, _toUint8(value)); |
982 } | 1140 } |
983 | 1141 |
| 1142 static const int BYTES_PER_ELEMENT = 1; |
984 | 1143 |
985 // Methods implementing TypedData interface. | 1144 // Methods implementing TypedData interface. |
986 int get elementSizeInBytes { | 1145 int get elementSizeInBytes { |
987 return Uint8List.BYTES_PER_ELEMENT; | 1146 return Uint8List.BYTES_PER_ELEMENT; |
988 } | 1147 } |
989 | 1148 |
990 | 1149 |
991 // Internal utility methods. | 1150 // Internal utility methods. |
992 | 1151 |
993 _Uint8Array _createList(int length) { | 1152 Uint8List _createList(int length) { |
994 return new _Uint8Array(length); | 1153 return new Uint8List(length); |
995 } | 1154 } |
996 } | 1155 } |
997 | 1156 |
998 | 1157 |
999 class _Uint8ClampedArray extends _TypedList with _IntListMixin implements Uint8C
lampedList { | 1158 class Uint8ClampedList extends _TypedList with _IntListMixin implements List<int
>, TypedData { |
1000 // Factory constructors. | 1159 // Factory constructors. |
1001 | 1160 |
1002 factory _Uint8ClampedArray(int length) native "TypedData_Uint8ClampedArray_new
"; | 1161 factory Uint8ClampedList(int length) native "TypedData_Uint8ClampedArray_new"; |
| 1162 |
| 1163 factory Uint8ClampedList.fromList(List<int> elements) { |
| 1164 return new Uint8ClampedList(elements.length) |
| 1165 ..setRange(0, elements.length, elements); |
| 1166 } |
| 1167 |
| 1168 factory Uint8ClampedList.view(ByteBuffer buffer, |
| 1169 [int offsetInBytes = 0, int length]) { |
| 1170 return buffer.asUint8ClampedList(offsetInBytes, length); |
| 1171 } |
1003 | 1172 |
1004 // Methods implementing List interface. | 1173 // Methods implementing List interface. |
1005 | 1174 |
1006 int operator[](int index) { | 1175 int operator[](int index) { |
1007 if (index < 0 || index >= length) { | 1176 if (index < 0 || index >= length) { |
1008 throw new RangeError.index(index, this, "index"); | 1177 throw new RangeError.index(index, this, "index"); |
1009 } | 1178 } |
1010 return _getUint8(index); | 1179 return _getUint8(index); |
1011 } | 1180 } |
1012 | 1181 |
1013 void operator[]=(int index, int value) { | 1182 void operator[]=(int index, int value) { |
1014 if (index < 0 || index >= length) { | 1183 if (index < 0 || index >= length) { |
1015 throw new RangeError.index(index, this, "index"); | 1184 throw new RangeError.index(index, this, "index"); |
1016 } | 1185 } |
1017 _setUint8(index, _toClampedUint8(value)); | 1186 _setUint8(index, _toClampedUint8(value)); |
1018 } | 1187 } |
1019 | 1188 |
| 1189 static const int BYTES_PER_ELEMENT = 1; |
1020 | 1190 |
1021 // Methods implementing TypedData interface. | 1191 // Methods implementing TypedData interface. |
1022 int get elementSizeInBytes { | 1192 int get elementSizeInBytes { |
1023 return Uint8List.BYTES_PER_ELEMENT; | 1193 return Uint8List.BYTES_PER_ELEMENT; |
1024 } | 1194 } |
1025 | 1195 |
1026 | 1196 |
1027 // Internal utility methods. | 1197 // Internal utility methods. |
1028 | 1198 |
1029 _Uint8ClampedArray _createList(int length) { | 1199 Uint8ClampedList _createList(int length) { |
1030 return new _Uint8ClampedArray(length); | 1200 return new Uint8ClampedList(length); |
1031 } | 1201 } |
1032 } | 1202 } |
1033 | 1203 |
1034 | 1204 |
1035 class _Int16Array extends _TypedList with _IntListMixin implements Int16List { | 1205 class Int16List extends _TypedList with _IntListMixin implements List<int>, Type
dData { |
1036 // Factory constructors. | 1206 // Factory constructors. |
1037 | 1207 |
1038 factory _Int16Array(int length) native "TypedData_Int16Array_new"; | 1208 factory Int16List(int length) native "TypedData_Int16Array_new"; |
| 1209 |
| 1210 factory Int16List.fromList(List<int> elements) { |
| 1211 return new Int16List(elements.length) |
| 1212 ..setRange(0, elements.length, elements); |
| 1213 } |
| 1214 |
| 1215 factory Int16List.view(ByteBuffer buffer, |
| 1216 [int offsetInBytes = 0, int length]) { |
| 1217 return buffer.asInt16List(offsetInBytes, length); |
| 1218 } |
1039 | 1219 |
1040 // Method(s) implementing List interface. | 1220 // Method(s) implementing List interface. |
1041 | 1221 |
1042 int operator[](int index) { | 1222 int operator[](int index) { |
1043 if (index < 0 || index >= length) { | 1223 if (index < 0 || index >= length) { |
1044 throw new RangeError.index(index, this, "index"); | 1224 throw new RangeError.index(index, this, "index"); |
1045 } | 1225 } |
1046 return _getIndexedInt16(index); | 1226 return _getIndexedInt16(index); |
1047 } | 1227 } |
1048 | 1228 |
1049 void operator[]=(int index, int value) { | 1229 void operator[]=(int index, int value) { |
1050 if (index < 0 || index >= length) { | 1230 if (index < 0 || index >= length) { |
1051 throw new RangeError.index(index, this, "index"); | 1231 throw new RangeError.index(index, this, "index"); |
1052 } | 1232 } |
1053 _setIndexedInt16(index, _toInt16(value)); | 1233 _setIndexedInt16(index, _toInt16(value)); |
1054 } | 1234 } |
1055 | 1235 |
1056 void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) { | 1236 void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) { |
1057 if (ClassID.getID(iterable) == CodeUnits.cid) { | 1237 if (ClassID.getID(iterable) == CodeUnits.cid) { |
1058 end = RangeError.checkValidRange(start, end, this.length); | 1238 end = RangeError.checkValidRange(start, end, this.length); |
1059 int length = end - start; | 1239 int length = end - start; |
1060 int byteStart = this.offsetInBytes + start * Int16List.BYTES_PER_ELEMENT; | 1240 int byteStart = this.offsetInBytes + start * Int16List.BYTES_PER_ELEMENT; |
1061 _setCodeUnits(iterable, byteStart, length, skipCount); | 1241 _setCodeUnits(iterable, byteStart, length, skipCount); |
1062 } else { | 1242 } else { |
1063 super.setRange(start, end, iterable, skipCount); | 1243 super.setRange(start, end, iterable, skipCount); |
1064 } | 1244 } |
1065 } | 1245 } |
1066 | 1246 |
1067 // Method(s) implementing TypedData interface. | 1247 // Method(s) implementing TypedData interface. |
| 1248 static const int BYTES_PER_ELEMENT = 2; |
1068 | 1249 |
1069 int get elementSizeInBytes { | 1250 int get elementSizeInBytes { |
1070 return Int16List.BYTES_PER_ELEMENT; | 1251 return Int16List.BYTES_PER_ELEMENT; |
1071 } | 1252 } |
1072 | 1253 |
1073 | 1254 |
1074 // Internal utility methods. | 1255 // Internal utility methods. |
1075 | 1256 |
1076 _Int16Array _createList(int length) { | 1257 Int16List _createList(int length) { |
1077 return new _Int16Array(length); | 1258 return new Int16List(length); |
1078 } | 1259 } |
1079 | 1260 |
1080 int _getIndexedInt16(int index) { | 1261 int _getIndexedInt16(int index) { |
1081 return _getInt16(index * Int16List.BYTES_PER_ELEMENT); | 1262 return _getInt16(index * Int16List.BYTES_PER_ELEMENT); |
1082 } | 1263 } |
1083 | 1264 |
1084 void _setIndexedInt16(int index, int value) { | 1265 void _setIndexedInt16(int index, int value) { |
1085 _setInt16(index * Int16List.BYTES_PER_ELEMENT, value); | 1266 _setInt16(index * Int16List.BYTES_PER_ELEMENT, value); |
1086 } | 1267 } |
1087 } | 1268 } |
1088 | 1269 |
1089 | 1270 |
1090 class _Uint16Array extends _TypedList with _IntListMixin implements Uint16List { | 1271 class Uint16List extends _TypedList with _IntListMixin implements List<int>, Typ
edData { |
1091 // Factory constructors. | 1272 // Factory constructors. |
1092 | 1273 |
1093 factory _Uint16Array(int length) native "TypedData_Uint16Array_new"; | 1274 factory Uint16List(int length) native "TypedData_Uint16Array_new"; |
| 1275 |
| 1276 factory Uint16List.fromList(List<int> elements) { |
| 1277 return new Uint16List(elements.length) |
| 1278 ..setRange(0, elements.length, elements); |
| 1279 } |
| 1280 |
| 1281 factory Uint16List.view(ByteBuffer buffer, |
| 1282 [int offsetInBytes = 0, int length]) { |
| 1283 return buffer.asUint16List(offsetInBytes, length); |
| 1284 } |
1094 | 1285 |
1095 // Method(s) implementing the List interface. | 1286 // Method(s) implementing the List interface. |
1096 | 1287 |
1097 int operator[](int index) { | 1288 int operator[](int index) { |
1098 if (index < 0 || index >= length) { | 1289 if (index < 0 || index >= length) { |
1099 throw new RangeError.index(index, this, "index"); | 1290 throw new RangeError.index(index, this, "index"); |
1100 } | 1291 } |
1101 return _getIndexedUint16(index); | 1292 return _getIndexedUint16(index); |
1102 } | 1293 } |
1103 | 1294 |
1104 void operator[]=(int index, int value) { | 1295 void operator[]=(int index, int value) { |
1105 if (index < 0 || index >= length) { | 1296 if (index < 0 || index >= length) { |
1106 throw new RangeError.index(index, this, "index"); | 1297 throw new RangeError.index(index, this, "index"); |
1107 } | 1298 } |
1108 _setIndexedUint16(index, _toUint16(value)); | 1299 _setIndexedUint16(index, _toUint16(value)); |
1109 } | 1300 } |
1110 | 1301 |
1111 void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) { | 1302 void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) { |
1112 if (ClassID.getID(iterable) == CodeUnits.cid) { | 1303 if (ClassID.getID(iterable) == CodeUnits.cid) { |
1113 end = RangeError.checkValidRange(start, end, this.length); | 1304 end = RangeError.checkValidRange(start, end, this.length); |
1114 int length = end - start; | 1305 int length = end - start; |
1115 int byteStart = this.offsetInBytes + start * Uint16List.BYTES_PER_ELEMENT; | 1306 int byteStart = this.offsetInBytes + start * Uint16List.BYTES_PER_ELEMENT; |
1116 _setCodeUnits(iterable, byteStart, length, skipCount); | 1307 _setCodeUnits(iterable, byteStart, length, skipCount); |
1117 } else { | 1308 } else { |
1118 super.setRange(start, end, iterable, skipCount); | 1309 super.setRange(start, end, iterable, skipCount); |
1119 } | 1310 } |
1120 } | 1311 } |
1121 | 1312 |
1122 // Method(s) implementing the TypedData interface. | 1313 // Method(s) implementing the TypedData interface. |
| 1314 static const int BYTES_PER_ELEMENT = 2; |
1123 | 1315 |
1124 int get elementSizeInBytes { | 1316 int get elementSizeInBytes { |
1125 return Uint16List.BYTES_PER_ELEMENT; | 1317 return Uint16List.BYTES_PER_ELEMENT; |
1126 } | 1318 } |
1127 | 1319 |
1128 | 1320 |
1129 // Internal utility methods. | 1321 // Internal utility methods. |
1130 | 1322 |
1131 _Uint16Array _createList(int length) { | 1323 Uint16List _createList(int length) { |
1132 return new _Uint16Array(length); | 1324 return new Uint16List(length); |
1133 } | 1325 } |
1134 | 1326 |
1135 int _getIndexedUint16(int index) { | 1327 int _getIndexedUint16(int index) { |
1136 return _getUint16(index * Uint16List.BYTES_PER_ELEMENT); | 1328 return _getUint16(index * Uint16List.BYTES_PER_ELEMENT); |
1137 } | 1329 } |
1138 | 1330 |
1139 void _setIndexedUint16(int index, int value) { | 1331 void _setIndexedUint16(int index, int value) { |
1140 _setUint16(index * Uint16List.BYTES_PER_ELEMENT, value); | 1332 _setUint16(index * Uint16List.BYTES_PER_ELEMENT, value); |
1141 } | 1333 } |
1142 } | 1334 } |
1143 | 1335 |
1144 | 1336 |
1145 class _Int32Array extends _TypedList with _IntListMixin implements Int32List { | 1337 class Int32List extends _TypedList with _IntListMixin implements List<int>, Type
dData { |
1146 // Factory constructors. | 1338 // Factory constructors. |
1147 | 1339 |
1148 factory _Int32Array(int length) native "TypedData_Int32Array_new"; | 1340 factory Int32List(int length) native "TypedData_Int32Array_new"; |
| 1341 |
| 1342 factory Int32List.fromList(List<int> elements) { |
| 1343 return new Int32List(elements.length) |
| 1344 ..setRange(0, elements.length, elements); |
| 1345 } |
| 1346 |
| 1347 factory Int32List.view(ByteBuffer buffer, |
| 1348 [int offsetInBytes = 0, int length]) { |
| 1349 return buffer.asInt32List(offsetInBytes, length); |
| 1350 } |
1149 | 1351 |
1150 // Method(s) implementing the List interface. | 1352 // Method(s) implementing the List interface. |
1151 | 1353 |
1152 int operator[](int index) { | 1354 int operator[](int index) { |
1153 if (index < 0 || index >= length) { | 1355 if (index < 0 || index >= length) { |
1154 throw new RangeError.index(index, this, "index"); | 1356 throw new RangeError.index(index, this, "index"); |
1155 } | 1357 } |
1156 return _getIndexedInt32(index); | 1358 return _getIndexedInt32(index); |
1157 } | 1359 } |
1158 | 1360 |
1159 void operator[]=(int index, int value) { | 1361 void operator[]=(int index, int value) { |
1160 if (index < 0 || index >= length) { | 1362 if (index < 0 || index >= length) { |
1161 throw new RangeError.index(index, this, "index"); | 1363 throw new RangeError.index(index, this, "index"); |
1162 } | 1364 } |
1163 _setIndexedInt32(index, _toInt32(value)); | 1365 _setIndexedInt32(index, _toInt32(value)); |
1164 } | 1366 } |
1165 | 1367 |
1166 | 1368 |
1167 // Method(s) implementing TypedData interface. | 1369 // Method(s) implementing TypedData interface. |
| 1370 static const int BYTES_PER_ELEMENT = 4; |
1168 | 1371 |
1169 int get elementSizeInBytes { | 1372 int get elementSizeInBytes { |
1170 return Int32List.BYTES_PER_ELEMENT; | 1373 return Int32List.BYTES_PER_ELEMENT; |
1171 } | 1374 } |
1172 | 1375 |
1173 | 1376 |
1174 // Internal utility methods. | 1377 // Internal utility methods. |
1175 | 1378 |
1176 _Int32Array _createList(int length) { | 1379 Int32List _createList(int length) { |
1177 return new _Int32Array(length); | 1380 return new Int32List(length); |
1178 } | 1381 } |
1179 | 1382 |
1180 int _getIndexedInt32(int index) { | 1383 int _getIndexedInt32(int index) { |
1181 return _getInt32(index * Int32List.BYTES_PER_ELEMENT); | 1384 return _getInt32(index * Int32List.BYTES_PER_ELEMENT); |
1182 } | 1385 } |
1183 | 1386 |
1184 void _setIndexedInt32(int index, int value) { | 1387 void _setIndexedInt32(int index, int value) { |
1185 _setInt32(index * Int32List.BYTES_PER_ELEMENT, value); | 1388 _setInt32(index * Int32List.BYTES_PER_ELEMENT, value); |
1186 } | 1389 } |
1187 | 1390 |
1188 } | 1391 } |
1189 | 1392 |
1190 | 1393 |
1191 class _Uint32Array extends _TypedList with _IntListMixin implements Uint32List { | 1394 class Uint32List extends _TypedList with _IntListMixin implements List<int>, Typ
edData { |
1192 // Factory constructors. | 1395 // Factory constructors. |
1193 | 1396 |
1194 factory _Uint32Array(int length) native "TypedData_Uint32Array_new"; | 1397 factory Uint32List(int length) native "TypedData_Uint32Array_new"; |
| 1398 |
| 1399 factory Uint32List.fromList(List<int> elements) { |
| 1400 return new Uint32List(elements.length) |
| 1401 ..setRange(0, elements.length, elements); |
| 1402 } |
| 1403 |
| 1404 factory Uint32List.view(ByteBuffer buffer, |
| 1405 [int offsetInBytes = 0, int length]) { |
| 1406 return buffer.asUint32List(offsetInBytes, length); |
| 1407 } |
1195 | 1408 |
1196 // Method(s) implementing the List interface. | 1409 // Method(s) implementing the List interface. |
1197 | 1410 |
1198 int operator[](int index) { | 1411 int operator[](int index) { |
1199 if (index < 0 || index >= length) { | 1412 if (index < 0 || index >= length) { |
1200 throw new RangeError.index(index, this, "index"); | 1413 throw new RangeError.index(index, this, "index"); |
1201 } | 1414 } |
1202 return _getIndexedUint32(index); | 1415 return _getIndexedUint32(index); |
1203 } | 1416 } |
1204 | 1417 |
1205 void operator[]=(int index, int value) { | 1418 void operator[]=(int index, int value) { |
1206 if (index < 0 || index >= length) { | 1419 if (index < 0 || index >= length) { |
1207 throw new RangeError.index(index, this, "index"); | 1420 throw new RangeError.index(index, this, "index"); |
1208 } | 1421 } |
1209 _setIndexedUint32(index, _toUint32(value)); | 1422 _setIndexedUint32(index, _toUint32(value)); |
1210 } | 1423 } |
1211 | 1424 |
1212 | 1425 |
1213 // Method(s) implementing the TypedData interface. | 1426 // Method(s) implementing the TypedData interface. |
| 1427 static const int BYTES_PER_ELEMENT = 4; |
1214 | 1428 |
1215 int get elementSizeInBytes { | 1429 int get elementSizeInBytes { |
1216 return Uint32List.BYTES_PER_ELEMENT; | 1430 return Uint32List.BYTES_PER_ELEMENT; |
1217 } | 1431 } |
1218 | 1432 |
1219 | 1433 |
1220 // Internal utility methods. | 1434 // Internal utility methods. |
1221 | 1435 |
1222 _Uint32Array _createList(int length) { | 1436 Uint32List _createList(int length) { |
1223 return new _Uint32Array(length); | 1437 return new Uint32List(length); |
1224 } | 1438 } |
1225 | 1439 |
1226 int _getIndexedUint32(int index) { | 1440 int _getIndexedUint32(int index) { |
1227 return _getUint32(index * Uint32List.BYTES_PER_ELEMENT); | 1441 return _getUint32(index * Uint32List.BYTES_PER_ELEMENT); |
1228 } | 1442 } |
1229 | 1443 |
1230 void _setIndexedUint32(int index, int value) { | 1444 void _setIndexedUint32(int index, int value) { |
1231 _setUint32(index * Uint32List.BYTES_PER_ELEMENT, value); | 1445 _setUint32(index * Uint32List.BYTES_PER_ELEMENT, value); |
1232 } | 1446 } |
1233 } | 1447 } |
1234 | 1448 |
1235 | 1449 |
1236 class _Int64Array extends _TypedList with _IntListMixin implements Int64List { | 1450 class Int64List extends _TypedList with _IntListMixin implements List<int>, Type
dData { |
1237 // Factory constructors. | 1451 // Factory constructors. |
1238 | 1452 |
1239 factory _Int64Array(int length) native "TypedData_Int64Array_new"; | 1453 factory Int64List(int length) native "TypedData_Int64Array_new"; |
| 1454 |
| 1455 factory Int64List.fromList(List<int> elements) { |
| 1456 return new Int64List(elements.length) |
| 1457 ..setRange(0, elements.length, elements); |
| 1458 } |
| 1459 |
| 1460 factory Int64List.view(ByteBuffer buffer, |
| 1461 [int offsetInBytes = 0, int length]) { |
| 1462 return buffer.asInt64List(offsetInBytes, length); |
| 1463 } |
1240 | 1464 |
1241 // Method(s) implementing the List interface. | 1465 // Method(s) implementing the List interface. |
1242 | 1466 |
1243 int operator[](int index) { | 1467 int operator[](int index) { |
1244 if (index < 0 || index >= length) { | 1468 if (index < 0 || index >= length) { |
1245 throw new RangeError.index(index, this, "index"); | 1469 throw new RangeError.index(index, this, "index"); |
1246 } | 1470 } |
1247 return _getIndexedInt64(index); | 1471 return _getIndexedInt64(index); |
1248 } | 1472 } |
1249 | 1473 |
1250 void operator[]=(int index, int value) { | 1474 void operator[]=(int index, int value) { |
1251 if (index < 0 || index >= length) { | 1475 if (index < 0 || index >= length) { |
1252 throw new RangeError.index(index, this, "index"); | 1476 throw new RangeError.index(index, this, "index"); |
1253 } | 1477 } |
1254 _setIndexedInt64(index, _toInt64(value)); | 1478 _setIndexedInt64(index, _toInt64(value)); |
1255 } | 1479 } |
1256 | 1480 |
1257 | 1481 |
1258 // Method(s) implementing the TypedData interface. | 1482 // Method(s) implementing the TypedData interface. |
| 1483 static const int BYTES_PER_ELEMENT = 8; |
1259 | 1484 |
1260 int get elementSizeInBytes { | 1485 int get elementSizeInBytes { |
1261 return Int64List.BYTES_PER_ELEMENT; | 1486 return Int64List.BYTES_PER_ELEMENT; |
1262 } | 1487 } |
1263 | 1488 |
1264 | 1489 |
1265 // Internal utility methods. | 1490 // Internal utility methods. |
1266 | 1491 |
1267 _Int64Array _createList(int length) { | 1492 Int64List _createList(int length) { |
1268 return new _Int64Array(length); | 1493 return new Int64List(length); |
1269 } | 1494 } |
1270 | 1495 |
1271 int _getIndexedInt64(int index) { | 1496 int _getIndexedInt64(int index) { |
1272 return _getInt64(index * Int64List.BYTES_PER_ELEMENT); | 1497 return _getInt64(index * Int64List.BYTES_PER_ELEMENT); |
1273 } | 1498 } |
1274 | 1499 |
1275 void _setIndexedInt64(int index, int value) { | 1500 void _setIndexedInt64(int index, int value) { |
1276 _setInt64(index * Int64List.BYTES_PER_ELEMENT, value); | 1501 _setInt64(index * Int64List.BYTES_PER_ELEMENT, value); |
1277 } | 1502 } |
1278 } | 1503 } |
1279 | 1504 |
1280 | 1505 |
1281 class _Uint64Array extends _TypedList with _IntListMixin implements Uint64List { | 1506 class Uint64List extends _TypedList with _IntListMixin implements List<int>, Typ
edData { |
1282 // Factory constructors. | 1507 // Factory constructors. |
1283 | 1508 |
1284 factory _Uint64Array(int length) native "TypedData_Uint64Array_new"; | 1509 factory Uint64List(int length) native "TypedData_Uint64Array_new"; |
| 1510 |
| 1511 factory Uint64List.fromList(List<int> elements) { |
| 1512 return new Uint64List(elements.length) |
| 1513 ..setRange(0, elements.length, elements); |
| 1514 } |
| 1515 |
| 1516 factory Uint64List.view(ByteBuffer buffer, |
| 1517 [int offsetInBytes = 0, int length]) { |
| 1518 return buffer.asUint64List(offsetInBytes, length); |
| 1519 } |
1285 | 1520 |
1286 // Method(s) implementing the List interface. | 1521 // Method(s) implementing the List interface. |
1287 | 1522 |
1288 int operator[](int index) { | 1523 int operator[](int index) { |
1289 if (index < 0 || index >= length) { | 1524 if (index < 0 || index >= length) { |
1290 throw new RangeError.index(index, this, "index"); | 1525 throw new RangeError.index(index, this, "index"); |
1291 } | 1526 } |
1292 return _getIndexedUint64(index); | 1527 return _getIndexedUint64(index); |
1293 } | 1528 } |
1294 | 1529 |
1295 void operator[]=(int index, int value) { | 1530 void operator[]=(int index, int value) { |
1296 if (index < 0 || index >= length) { | 1531 if (index < 0 || index >= length) { |
1297 throw new RangeError.index(index, this, "index"); | 1532 throw new RangeError.index(index, this, "index"); |
1298 } | 1533 } |
1299 _setIndexedUint64(index, _toUint64(value)); | 1534 _setIndexedUint64(index, _toUint64(value)); |
1300 } | 1535 } |
1301 | 1536 |
1302 | 1537 |
1303 // Method(s) implementing the TypedData interface. | 1538 // Method(s) implementing the TypedData interface. |
| 1539 static const int BYTES_PER_ELEMENT = 8; |
1304 | 1540 |
1305 int get elementSizeInBytes { | 1541 int get elementSizeInBytes { |
1306 return Uint64List.BYTES_PER_ELEMENT; | 1542 return Uint64List.BYTES_PER_ELEMENT; |
1307 } | 1543 } |
1308 | 1544 |
1309 | 1545 |
1310 // Internal utility methods. | 1546 // Internal utility methods. |
1311 | 1547 |
1312 _Uint64Array _createList(int length) { | 1548 Uint64List _createList(int length) { |
1313 return new _Uint64Array(length); | 1549 return new Uint64List(length); |
1314 } | 1550 } |
1315 | 1551 |
1316 int _getIndexedUint64(int index) { | 1552 int _getIndexedUint64(int index) { |
1317 return _getUint64(index * Uint64List.BYTES_PER_ELEMENT); | 1553 return _getUint64(index * Uint64List.BYTES_PER_ELEMENT); |
1318 } | 1554 } |
1319 | 1555 |
1320 void _setIndexedUint64(int index, int value) { | 1556 void _setIndexedUint64(int index, int value) { |
1321 _setUint64(index * Uint64List.BYTES_PER_ELEMENT, value); | 1557 _setUint64(index * Uint64List.BYTES_PER_ELEMENT, value); |
1322 } | 1558 } |
1323 } | 1559 } |
1324 | 1560 |
1325 | 1561 |
1326 class _Float32Array extends _TypedList with _DoubleListMixin implements Float32L
ist { | 1562 class Float32List extends _TypedList with _DoubleListMixin implements List<doubl
e>, TypedData { |
1327 // Factory constructors. | 1563 // Factory constructors. |
1328 | 1564 |
1329 factory _Float32Array(int length) native "TypedData_Float32Array_new"; | 1565 factory Float32List(int length) native "TypedData_Float32Array_new"; |
| 1566 |
| 1567 factory Float32List.fromList(List<double> elements) { |
| 1568 return new Float32List(elements.length) |
| 1569 ..setRange(0, elements.length, elements); |
| 1570 } |
| 1571 |
| 1572 factory Float32List.view(ByteBuffer buffer, |
| 1573 [int offsetInBytes = 0, int length]) { |
| 1574 return buffer.asFloat32List(offsetInBytes, length); |
| 1575 } |
1330 | 1576 |
1331 // Method(s) implementing the List interface. | 1577 // Method(s) implementing the List interface. |
1332 | 1578 |
1333 double operator[](int index) { | 1579 double operator[](int index) { |
1334 if (index < 0 || index >= length) { | 1580 if (index < 0 || index >= length) { |
1335 throw new RangeError.index(index, this, "index"); | 1581 throw new RangeError.index(index, this, "index"); |
1336 } | 1582 } |
1337 return _getIndexedFloat32(index); | 1583 return _getIndexedFloat32(index); |
1338 } | 1584 } |
1339 | 1585 |
1340 void operator[]=(int index, double value) { | 1586 void operator[]=(int index, double value) { |
1341 if (index < 0 || index >= length) { | 1587 if (index < 0 || index >= length) { |
1342 throw new RangeError.index(index, this, "index"); | 1588 throw new RangeError.index(index, this, "index"); |
1343 } | 1589 } |
1344 _setIndexedFloat32(index, value); | 1590 _setIndexedFloat32(index, value); |
1345 } | 1591 } |
1346 | 1592 |
1347 | 1593 |
1348 // Method(s) implementing the TypedData interface. | 1594 // Method(s) implementing the TypedData interface. |
| 1595 static const int BYTES_PER_ELEMENT = 4; |
1349 | 1596 |
1350 int get elementSizeInBytes { | 1597 int get elementSizeInBytes { |
1351 return Float32List.BYTES_PER_ELEMENT; | 1598 return Float32List.BYTES_PER_ELEMENT; |
1352 } | 1599 } |
1353 | 1600 |
1354 | 1601 |
1355 // Internal utility methods. | 1602 // Internal utility methods. |
1356 | 1603 |
1357 _Float32Array _createList(int length) { | 1604 Float32List _createList(int length) { |
1358 return new _Float32Array(length); | 1605 return new Float32List(length); |
1359 } | 1606 } |
1360 | 1607 |
1361 double _getIndexedFloat32(int index) { | 1608 double _getIndexedFloat32(int index) { |
1362 return _getFloat32(index * Float32List.BYTES_PER_ELEMENT); | 1609 return _getFloat32(index * Float32List.BYTES_PER_ELEMENT); |
1363 } | 1610 } |
1364 | 1611 |
1365 void _setIndexedFloat32(int index, double value) { | 1612 void _setIndexedFloat32(int index, double value) { |
1366 _setFloat32(index * Float32List.BYTES_PER_ELEMENT, value); | 1613 _setFloat32(index * Float32List.BYTES_PER_ELEMENT, value); |
1367 } | 1614 } |
1368 } | 1615 } |
1369 | 1616 |
1370 | 1617 |
1371 class _Float64Array extends _TypedList with _DoubleListMixin implements Float64L
ist { | 1618 class Float64List extends _TypedList with _DoubleListMixin implements List<doubl
e>, TypedData { |
1372 // Factory constructors. | 1619 // Factory constructors. |
1373 | 1620 |
1374 factory _Float64Array(int length) native "TypedData_Float64Array_new"; | 1621 factory Float64List(int length) native "TypedData_Float64Array_new"; |
| 1622 |
| 1623 factory Float64List.fromList(List<double> elements) { |
| 1624 return new Float64List(elements.length) |
| 1625 ..setRange(0, elements.length, elements); |
| 1626 } |
| 1627 |
| 1628 factory Float64List.view(ByteBuffer buffer, |
| 1629 [int offsetInBytes = 0, int length]) { |
| 1630 return buffer.asFloat64List(offsetInBytes, length); |
| 1631 } |
1375 | 1632 |
1376 // Method(s) implementing the List interface. | 1633 // Method(s) implementing the List interface. |
1377 | 1634 |
1378 double operator[](int index) { | 1635 double operator[](int index) { |
1379 if (index < 0 || index >= length) { | 1636 if (index < 0 || index >= length) { |
1380 throw new RangeError.index(index, this, "index"); | 1637 throw new RangeError.index(index, this, "index"); |
1381 } | 1638 } |
1382 return _getIndexedFloat64(index); | 1639 return _getIndexedFloat64(index); |
1383 } | 1640 } |
1384 | 1641 |
1385 void operator[]=(int index, double value) { | 1642 void operator[]=(int index, double value) { |
1386 if (index < 0 || index >= length) { | 1643 if (index < 0 || index >= length) { |
1387 throw new RangeError.index(index, this, "index"); | 1644 throw new RangeError.index(index, this, "index"); |
1388 } | 1645 } |
1389 _setIndexedFloat64(index, value); | 1646 _setIndexedFloat64(index, value); |
1390 } | 1647 } |
1391 | 1648 |
1392 | 1649 |
1393 // Method(s) implementing the TypedData interface. | 1650 // Method(s) implementing the TypedData interface. |
| 1651 static const int BYTES_PER_ELEMENT = 8; |
1394 | 1652 |
1395 int get elementSizeInBytes { | 1653 int get elementSizeInBytes { |
1396 return Float64List.BYTES_PER_ELEMENT; | 1654 return Float64List.BYTES_PER_ELEMENT; |
1397 } | 1655 } |
1398 | 1656 |
1399 | 1657 |
1400 // Internal utility methods. | 1658 // Internal utility methods. |
1401 | 1659 |
1402 _Float64Array _createList(int length) { | 1660 Float64List _createList(int length) { |
1403 return new _Float64Array(length); | 1661 return new Float64List(length); |
1404 } | 1662 } |
1405 | 1663 |
1406 double _getIndexedFloat64(int index) { | 1664 double _getIndexedFloat64(int index) { |
1407 return _getFloat64(index * Float64List.BYTES_PER_ELEMENT); | 1665 return _getFloat64(index * Float64List.BYTES_PER_ELEMENT); |
1408 } | 1666 } |
1409 | 1667 |
1410 void _setIndexedFloat64(int index, double value) { | 1668 void _setIndexedFloat64(int index, double value) { |
1411 _setFloat64(index * Float64List.BYTES_PER_ELEMENT, value); | 1669 _setFloat64(index * Float64List.BYTES_PER_ELEMENT, value); |
1412 } | 1670 } |
1413 } | 1671 } |
1414 | 1672 |
1415 | 1673 |
1416 class _Float32x4Array extends _TypedList with _Float32x4ListMixin implements Flo
at32x4List { | 1674 class Float32x4List extends _TypedList with _Float32x4ListMixin implements List<
Float32x4>, TypedData { |
1417 // Factory constructors. | 1675 // Factory constructors. |
1418 | 1676 |
1419 factory _Float32x4Array(int length) native "TypedData_Float32x4Array_new"; | 1677 factory Float32x4List(int length) native "TypedData_Float32x4Array_new"; |
| 1678 |
| 1679 factory Float32x4List.fromList(List<Float32x4> elements) { |
| 1680 return new Float32x4List(elements.length) |
| 1681 ..setRange(0, elements.length, elements); |
| 1682 } |
| 1683 |
| 1684 factory Float32x4List.view(ByteBuffer buffer, |
| 1685 [int offsetInBytes = 0, int length]) { |
| 1686 return buffer.asFloat32x4List(offsetInBytes, length); |
| 1687 } |
1420 | 1688 |
1421 Float32x4 operator[](int index) { | 1689 Float32x4 operator[](int index) { |
1422 if (index < 0 || index >= length) { | 1690 if (index < 0 || index >= length) { |
1423 throw new RangeError.index(index, this, "index"); | 1691 throw new RangeError.index(index, this, "index"); |
1424 } | 1692 } |
1425 return _getIndexedFloat32x4(index); | 1693 return _getIndexedFloat32x4(index); |
1426 } | 1694 } |
1427 | 1695 |
1428 void operator[]=(int index, Float32x4 value) { | 1696 void operator[]=(int index, Float32x4 value) { |
1429 if (index < 0 || index >= length) { | 1697 if (index < 0 || index >= length) { |
1430 throw new RangeError.index(index, this, "index"); | 1698 throw new RangeError.index(index, this, "index"); |
1431 } | 1699 } |
1432 _setIndexedFloat32x4(index, value); | 1700 _setIndexedFloat32x4(index, value); |
1433 } | 1701 } |
1434 | 1702 |
1435 | 1703 |
1436 // Method(s) implementing the TypedData interface. | 1704 // Method(s) implementing the TypedData interface. |
| 1705 static const int BYTES_PER_ELEMENT = 16; |
1437 | 1706 |
1438 int get elementSizeInBytes { | 1707 int get elementSizeInBytes { |
1439 return Float32x4List.BYTES_PER_ELEMENT; | 1708 return Float32x4List.BYTES_PER_ELEMENT; |
1440 } | 1709 } |
1441 | 1710 |
1442 | 1711 |
1443 // Internal utility methods. | 1712 // Internal utility methods. |
1444 | 1713 |
1445 _Float32x4Array _createList(int length) { | 1714 Float32x4List _createList(int length) { |
1446 return new _Float32x4Array(length); | 1715 return new Float32x4List(length); |
1447 } | 1716 } |
1448 | 1717 |
1449 Float32x4 _getIndexedFloat32x4(int index) { | 1718 Float32x4 _getIndexedFloat32x4(int index) { |
1450 return _getFloat32x4(index * Float32x4List.BYTES_PER_ELEMENT); | 1719 return _getFloat32x4(index * Float32x4List.BYTES_PER_ELEMENT); |
1451 } | 1720 } |
1452 | 1721 |
1453 void _setIndexedFloat32x4(int index, Float32x4 value) { | 1722 void _setIndexedFloat32x4(int index, Float32x4 value) { |
1454 _setFloat32x4(index * Float32x4List.BYTES_PER_ELEMENT, value); | 1723 _setFloat32x4(index * Float32x4List.BYTES_PER_ELEMENT, value); |
1455 } | 1724 } |
1456 } | 1725 } |
1457 | 1726 |
1458 | 1727 |
1459 class _Int32x4Array extends _TypedList with _Int32x4ListMixin implements Int32x4
List { | 1728 class Int32x4List extends _TypedList with _Int32x4ListMixin implements List<Int3
2x4>, TypedData { |
1460 // Factory constructors. | 1729 // Factory constructors. |
1461 | 1730 |
1462 factory _Int32x4Array(int length) native "TypedData_Int32x4Array_new"; | 1731 factory Int32x4List(int length) native "TypedData_Int32x4Array_new"; |
| 1732 |
| 1733 factory Int32x4List.fromList(List<Int32x4> elements) { |
| 1734 return new Int32x4List(elements.length) |
| 1735 ..setRange(0, elements.length, elements); |
| 1736 } |
| 1737 |
| 1738 factory Int32x4List.view(ByteBuffer buffer, |
| 1739 [int offsetInBytes = 0, int length]) { |
| 1740 return buffer.asInt32x4List(offsetInBytes, length); |
| 1741 } |
1463 | 1742 |
1464 Int32x4 operator[](int index) { | 1743 Int32x4 operator[](int index) { |
1465 if (index < 0 || index >= length) { | 1744 if (index < 0 || index >= length) { |
1466 throw new RangeError.index(index, this, "index"); | 1745 throw new RangeError.index(index, this, "index"); |
1467 } | 1746 } |
1468 return _getIndexedInt32x4(index); | 1747 return _getIndexedInt32x4(index); |
1469 } | 1748 } |
1470 | 1749 |
1471 void operator[]=(int index, Int32x4 value) { | 1750 void operator[]=(int index, Int32x4 value) { |
1472 if (index < 0 || index >= length) { | 1751 if (index < 0 || index >= length) { |
1473 throw new RangeError.index(index, this, "index"); | 1752 throw new RangeError.index(index, this, "index"); |
1474 } | 1753 } |
1475 _setIndexedInt32x4(index, value); | 1754 _setIndexedInt32x4(index, value); |
1476 } | 1755 } |
1477 | 1756 |
1478 | 1757 |
1479 // Method(s) implementing the TypedData interface. | 1758 // Method(s) implementing the TypedData interface. |
| 1759 static const int BYTES_PER_ELEMENT = 16; |
1480 | 1760 |
1481 int get elementSizeInBytes { | 1761 int get elementSizeInBytes { |
1482 return Int32x4List.BYTES_PER_ELEMENT; | 1762 return Int32x4List.BYTES_PER_ELEMENT; |
1483 } | 1763 } |
1484 | 1764 |
1485 | 1765 |
1486 // Internal utility methods. | 1766 // Internal utility methods. |
1487 | 1767 |
1488 _Int32x4Array _createList(int length) { | 1768 Int32x4List _createList(int length) { |
1489 return new _Int32x4Array(length); | 1769 return new Int32x4List(length); |
1490 } | 1770 } |
1491 | 1771 |
1492 Int32x4 _getIndexedInt32x4(int index) { | 1772 Int32x4 _getIndexedInt32x4(int index) { |
1493 return _getInt32x4(index * Int32x4List.BYTES_PER_ELEMENT); | 1773 return _getInt32x4(index * Int32x4List.BYTES_PER_ELEMENT); |
1494 } | 1774 } |
1495 | 1775 |
1496 void _setIndexedInt32x4(int index, Int32x4 value) { | 1776 void _setIndexedInt32x4(int index, Int32x4 value) { |
1497 _setInt32x4(index * Int32x4List.BYTES_PER_ELEMENT, value); | 1777 _setInt32x4(index * Int32x4List.BYTES_PER_ELEMENT, value); |
1498 } | 1778 } |
1499 } | 1779 } |
1500 | 1780 |
1501 | 1781 |
1502 class _Float64x2Array extends _TypedList with _Float64x2ListMixin implements Flo
at64x2List { | 1782 class Float64x2List extends _TypedList with _Float64x2ListMixin implements List<
Float64x2>, TypedData { |
1503 // Factory constructors. | 1783 // Factory constructors. |
1504 | 1784 |
1505 factory _Float64x2Array(int length) native "TypedData_Float64x2Array_new"; | 1785 factory Float64x2List(int length) native "TypedData_Float64x2Array_new"; |
| 1786 |
| 1787 factory Float64x2List.fromList(List<Float64x2> elements) { |
| 1788 return new Float64x2List(elements.length) |
| 1789 ..setRange(0, elements.length, elements); |
| 1790 } |
| 1791 |
| 1792 factory Float64x2List.view(ByteBuffer buffer, |
| 1793 [int offsetInBytes = 0, int length]) { |
| 1794 return buffer.asFloat64x2List(offsetInBytes, length); |
| 1795 } |
1506 | 1796 |
1507 Float64x2 operator[](int index) { | 1797 Float64x2 operator[](int index) { |
1508 if (index < 0 || index >= length) { | 1798 if (index < 0 || index >= length) { |
1509 throw new RangeError.index(index, this, "index"); | 1799 throw new RangeError.index(index, this, "index"); |
1510 } | 1800 } |
1511 return _getIndexedFloat64x2(index); | 1801 return _getIndexedFloat64x2(index); |
1512 } | 1802 } |
1513 | 1803 |
1514 void operator[]=(int index, Float64x2 value) { | 1804 void operator[]=(int index, Float64x2 value) { |
1515 if (index < 0 || index >= length) { | 1805 if (index < 0 || index >= length) { |
1516 throw new RangeError.index(index, this, "index"); | 1806 throw new RangeError.index(index, this, "index"); |
1517 } | 1807 } |
1518 _setIndexedFloat64x2(index, value); | 1808 _setIndexedFloat64x2(index, value); |
1519 } | 1809 } |
1520 | 1810 |
1521 | 1811 |
1522 // Method(s) implementing the TypedData interface. | 1812 // Method(s) implementing the TypedData interface. |
| 1813 static const int BYTES_PER_ELEMENT = 16; |
1523 | 1814 |
1524 int get elementSizeInBytes { | 1815 int get elementSizeInBytes { |
1525 return Float64x2List.BYTES_PER_ELEMENT; | 1816 return Float64x2List.BYTES_PER_ELEMENT; |
1526 } | 1817 } |
1527 | 1818 |
1528 | 1819 |
1529 // Internal utility methods. | 1820 // Internal utility methods. |
1530 | 1821 |
1531 _Float64x2Array _createList(int length) { | 1822 Float64x2List _createList(int length) { |
1532 return new _Float64x2Array(length); | 1823 return new Float64x2List(length); |
1533 } | 1824 } |
1534 | 1825 |
1535 Float64x2 _getIndexedFloat64x2(int index) { | 1826 Float64x2 _getIndexedFloat64x2(int index) { |
1536 return _getFloat64x2(index * Float64x2List.BYTES_PER_ELEMENT); | 1827 return _getFloat64x2(index * Float64x2List.BYTES_PER_ELEMENT); |
1537 } | 1828 } |
1538 | 1829 |
1539 void _setIndexedFloat64x2(int index, Float64x2 value) { | 1830 void _setIndexedFloat64x2(int index, Float64x2 value) { |
1540 _setFloat64x2(index * Float64x2List.BYTES_PER_ELEMENT, value); | 1831 _setFloat64x2(index * Float64x2List.BYTES_PER_ELEMENT, value); |
1541 } | 1832 } |
1542 } | 1833 } |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2140 Float64x2 _getIndexedFloat64x2(int index) { | 2431 Float64x2 _getIndexedFloat64x2(int index) { |
2141 return _getFloat64x2(index * Float64x2List.BYTES_PER_ELEMENT); | 2432 return _getFloat64x2(index * Float64x2List.BYTES_PER_ELEMENT); |
2142 } | 2433 } |
2143 | 2434 |
2144 void _setIndexedFloat64x2(int index, Float64x2 value) { | 2435 void _setIndexedFloat64x2(int index, Float64x2 value) { |
2145 _setFloat64x2(index * Float64x2List.BYTES_PER_ELEMENT, value); | 2436 _setFloat64x2(index * Float64x2List.BYTES_PER_ELEMENT, value); |
2146 } | 2437 } |
2147 } | 2438 } |
2148 | 2439 |
2149 | 2440 |
2150 class _Float32x4 implements Float32x4 { | 2441 class Float32x4 { |
2151 factory _Float32x4(double x, double y, double z, double w) | 2442 factory Float32x4(double x, double y, double z, double w) |
2152 native "Float32x4_fromDoubles"; | 2443 native "Float32x4_fromDoubles"; |
2153 factory _Float32x4.splat(double v) native "Float32x4_splat"; | 2444 factory Float32x4.splat(double v) native "Float32x4_splat"; |
2154 factory _Float32x4.zero() native "Float32x4_zero"; | 2445 factory Float32x4.zero() native "Float32x4_zero"; |
2155 factory _Float32x4.fromInt32x4Bits(Int32x4 x) | 2446 factory Float32x4.fromInt32x4Bits(Int32x4 x) |
2156 native "Float32x4_fromInt32x4Bits"; | 2447 native "Float32x4_fromInt32x4Bits"; |
2157 factory _Float32x4.fromFloat64x2(Float64x2 v) | 2448 factory Float32x4.fromFloat64x2(Float64x2 v) |
2158 native "Float32x4_fromFloat64x2"; | 2449 native "Float32x4_fromFloat64x2"; |
2159 Float32x4 operator +(Float32x4 other) { | 2450 Float32x4 operator +(Float32x4 other) { |
2160 return _add(other); | 2451 return _add(other); |
2161 } | 2452 } |
2162 Float32x4 _add(Float32x4 other) native "Float32x4_add"; | 2453 Float32x4 _add(Float32x4 other) native "Float32x4_add"; |
2163 Float32x4 operator -() { | 2454 Float32x4 operator -() { |
2164 return _negate(); | 2455 return _negate(); |
2165 } | 2456 } |
2166 Float32x4 _negate() native "Float32x4_negate"; | 2457 Float32x4 _negate() native "Float32x4_negate"; |
2167 Float32x4 operator -(Float32x4 other) { | 2458 Float32x4 operator -(Float32x4 other) { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2241 } | 2532 } |
2242 Float32x4 _sqrt() native "Float32x4_sqrt"; | 2533 Float32x4 _sqrt() native "Float32x4_sqrt"; |
2243 Float32x4 reciprocal() { | 2534 Float32x4 reciprocal() { |
2244 return _reciprocal(); | 2535 return _reciprocal(); |
2245 } | 2536 } |
2246 Float32x4 _reciprocal() native "Float32x4_reciprocal"; | 2537 Float32x4 _reciprocal() native "Float32x4_reciprocal"; |
2247 Float32x4 reciprocalSqrt() { | 2538 Float32x4 reciprocalSqrt() { |
2248 return _reciprocalSqrt(); | 2539 return _reciprocalSqrt(); |
2249 } | 2540 } |
2250 Float32x4 _reciprocalSqrt() native "Float32x4_reciprocalSqrt"; | 2541 Float32x4 _reciprocalSqrt() native "Float32x4_reciprocalSqrt"; |
| 2542 |
| 2543 /// Mask passed to [shuffle] or [shuffleMix]. |
| 2544 static const int XXXX = 0x0; |
| 2545 static const int XXXY = 0x40; |
| 2546 static const int XXXZ = 0x80; |
| 2547 static const int XXXW = 0xC0; |
| 2548 static const int XXYX = 0x10; |
| 2549 static const int XXYY = 0x50; |
| 2550 static const int XXYZ = 0x90; |
| 2551 static const int XXYW = 0xD0; |
| 2552 static const int XXZX = 0x20; |
| 2553 static const int XXZY = 0x60; |
| 2554 static const int XXZZ = 0xA0; |
| 2555 static const int XXZW = 0xE0; |
| 2556 static const int XXWX = 0x30; |
| 2557 static const int XXWY = 0x70; |
| 2558 static const int XXWZ = 0xB0; |
| 2559 static const int XXWW = 0xF0; |
| 2560 static const int XYXX = 0x4; |
| 2561 static const int XYXY = 0x44; |
| 2562 static const int XYXZ = 0x84; |
| 2563 static const int XYXW = 0xC4; |
| 2564 static const int XYYX = 0x14; |
| 2565 static const int XYYY = 0x54; |
| 2566 static const int XYYZ = 0x94; |
| 2567 static const int XYYW = 0xD4; |
| 2568 static const int XYZX = 0x24; |
| 2569 static const int XYZY = 0x64; |
| 2570 static const int XYZZ = 0xA4; |
| 2571 static const int XYZW = 0xE4; |
| 2572 static const int XYWX = 0x34; |
| 2573 static const int XYWY = 0x74; |
| 2574 static const int XYWZ = 0xB4; |
| 2575 static const int XYWW = 0xF4; |
| 2576 static const int XZXX = 0x8; |
| 2577 static const int XZXY = 0x48; |
| 2578 static const int XZXZ = 0x88; |
| 2579 static const int XZXW = 0xC8; |
| 2580 static const int XZYX = 0x18; |
| 2581 static const int XZYY = 0x58; |
| 2582 static const int XZYZ = 0x98; |
| 2583 static const int XZYW = 0xD8; |
| 2584 static const int XZZX = 0x28; |
| 2585 static const int XZZY = 0x68; |
| 2586 static const int XZZZ = 0xA8; |
| 2587 static const int XZZW = 0xE8; |
| 2588 static const int XZWX = 0x38; |
| 2589 static const int XZWY = 0x78; |
| 2590 static const int XZWZ = 0xB8; |
| 2591 static const int XZWW = 0xF8; |
| 2592 static const int XWXX = 0xC; |
| 2593 static const int XWXY = 0x4C; |
| 2594 static const int XWXZ = 0x8C; |
| 2595 static const int XWXW = 0xCC; |
| 2596 static const int XWYX = 0x1C; |
| 2597 static const int XWYY = 0x5C; |
| 2598 static const int XWYZ = 0x9C; |
| 2599 static const int XWYW = 0xDC; |
| 2600 static const int XWZX = 0x2C; |
| 2601 static const int XWZY = 0x6C; |
| 2602 static const int XWZZ = 0xAC; |
| 2603 static const int XWZW = 0xEC; |
| 2604 static const int XWWX = 0x3C; |
| 2605 static const int XWWY = 0x7C; |
| 2606 static const int XWWZ = 0xBC; |
| 2607 static const int XWWW = 0xFC; |
| 2608 static const int YXXX = 0x1; |
| 2609 static const int YXXY = 0x41; |
| 2610 static const int YXXZ = 0x81; |
| 2611 static const int YXXW = 0xC1; |
| 2612 static const int YXYX = 0x11; |
| 2613 static const int YXYY = 0x51; |
| 2614 static const int YXYZ = 0x91; |
| 2615 static const int YXYW = 0xD1; |
| 2616 static const int YXZX = 0x21; |
| 2617 static const int YXZY = 0x61; |
| 2618 static const int YXZZ = 0xA1; |
| 2619 static const int YXZW = 0xE1; |
| 2620 static const int YXWX = 0x31; |
| 2621 static const int YXWY = 0x71; |
| 2622 static const int YXWZ = 0xB1; |
| 2623 static const int YXWW = 0xF1; |
| 2624 static const int YYXX = 0x5; |
| 2625 static const int YYXY = 0x45; |
| 2626 static const int YYXZ = 0x85; |
| 2627 static const int YYXW = 0xC5; |
| 2628 static const int YYYX = 0x15; |
| 2629 static const int YYYY = 0x55; |
| 2630 static const int YYYZ = 0x95; |
| 2631 static const int YYYW = 0xD5; |
| 2632 static const int YYZX = 0x25; |
| 2633 static const int YYZY = 0x65; |
| 2634 static const int YYZZ = 0xA5; |
| 2635 static const int YYZW = 0xE5; |
| 2636 static const int YYWX = 0x35; |
| 2637 static const int YYWY = 0x75; |
| 2638 static const int YYWZ = 0xB5; |
| 2639 static const int YYWW = 0xF5; |
| 2640 static const int YZXX = 0x9; |
| 2641 static const int YZXY = 0x49; |
| 2642 static const int YZXZ = 0x89; |
| 2643 static const int YZXW = 0xC9; |
| 2644 static const int YZYX = 0x19; |
| 2645 static const int YZYY = 0x59; |
| 2646 static const int YZYZ = 0x99; |
| 2647 static const int YZYW = 0xD9; |
| 2648 static const int YZZX = 0x29; |
| 2649 static const int YZZY = 0x69; |
| 2650 static const int YZZZ = 0xA9; |
| 2651 static const int YZZW = 0xE9; |
| 2652 static const int YZWX = 0x39; |
| 2653 static const int YZWY = 0x79; |
| 2654 static const int YZWZ = 0xB9; |
| 2655 static const int YZWW = 0xF9; |
| 2656 static const int YWXX = 0xD; |
| 2657 static const int YWXY = 0x4D; |
| 2658 static const int YWXZ = 0x8D; |
| 2659 static const int YWXW = 0xCD; |
| 2660 static const int YWYX = 0x1D; |
| 2661 static const int YWYY = 0x5D; |
| 2662 static const int YWYZ = 0x9D; |
| 2663 static const int YWYW = 0xDD; |
| 2664 static const int YWZX = 0x2D; |
| 2665 static const int YWZY = 0x6D; |
| 2666 static const int YWZZ = 0xAD; |
| 2667 static const int YWZW = 0xED; |
| 2668 static const int YWWX = 0x3D; |
| 2669 static const int YWWY = 0x7D; |
| 2670 static const int YWWZ = 0xBD; |
| 2671 static const int YWWW = 0xFD; |
| 2672 static const int ZXXX = 0x2; |
| 2673 static const int ZXXY = 0x42; |
| 2674 static const int ZXXZ = 0x82; |
| 2675 static const int ZXXW = 0xC2; |
| 2676 static const int ZXYX = 0x12; |
| 2677 static const int ZXYY = 0x52; |
| 2678 static const int ZXYZ = 0x92; |
| 2679 static const int ZXYW = 0xD2; |
| 2680 static const int ZXZX = 0x22; |
| 2681 static const int ZXZY = 0x62; |
| 2682 static const int ZXZZ = 0xA2; |
| 2683 static const int ZXZW = 0xE2; |
| 2684 static const int ZXWX = 0x32; |
| 2685 static const int ZXWY = 0x72; |
| 2686 static const int ZXWZ = 0xB2; |
| 2687 static const int ZXWW = 0xF2; |
| 2688 static const int ZYXX = 0x6; |
| 2689 static const int ZYXY = 0x46; |
| 2690 static const int ZYXZ = 0x86; |
| 2691 static const int ZYXW = 0xC6; |
| 2692 static const int ZYYX = 0x16; |
| 2693 static const int ZYYY = 0x56; |
| 2694 static const int ZYYZ = 0x96; |
| 2695 static const int ZYYW = 0xD6; |
| 2696 static const int ZYZX = 0x26; |
| 2697 static const int ZYZY = 0x66; |
| 2698 static const int ZYZZ = 0xA6; |
| 2699 static const int ZYZW = 0xE6; |
| 2700 static const int ZYWX = 0x36; |
| 2701 static const int ZYWY = 0x76; |
| 2702 static const int ZYWZ = 0xB6; |
| 2703 static const int ZYWW = 0xF6; |
| 2704 static const int ZZXX = 0xA; |
| 2705 static const int ZZXY = 0x4A; |
| 2706 static const int ZZXZ = 0x8A; |
| 2707 static const int ZZXW = 0xCA; |
| 2708 static const int ZZYX = 0x1A; |
| 2709 static const int ZZYY = 0x5A; |
| 2710 static const int ZZYZ = 0x9A; |
| 2711 static const int ZZYW = 0xDA; |
| 2712 static const int ZZZX = 0x2A; |
| 2713 static const int ZZZY = 0x6A; |
| 2714 static const int ZZZZ = 0xAA; |
| 2715 static const int ZZZW = 0xEA; |
| 2716 static const int ZZWX = 0x3A; |
| 2717 static const int ZZWY = 0x7A; |
| 2718 static const int ZZWZ = 0xBA; |
| 2719 static const int ZZWW = 0xFA; |
| 2720 static const int ZWXX = 0xE; |
| 2721 static const int ZWXY = 0x4E; |
| 2722 static const int ZWXZ = 0x8E; |
| 2723 static const int ZWXW = 0xCE; |
| 2724 static const int ZWYX = 0x1E; |
| 2725 static const int ZWYY = 0x5E; |
| 2726 static const int ZWYZ = 0x9E; |
| 2727 static const int ZWYW = 0xDE; |
| 2728 static const int ZWZX = 0x2E; |
| 2729 static const int ZWZY = 0x6E; |
| 2730 static const int ZWZZ = 0xAE; |
| 2731 static const int ZWZW = 0xEE; |
| 2732 static const int ZWWX = 0x3E; |
| 2733 static const int ZWWY = 0x7E; |
| 2734 static const int ZWWZ = 0xBE; |
| 2735 static const int ZWWW = 0xFE; |
| 2736 static const int WXXX = 0x3; |
| 2737 static const int WXXY = 0x43; |
| 2738 static const int WXXZ = 0x83; |
| 2739 static const int WXXW = 0xC3; |
| 2740 static const int WXYX = 0x13; |
| 2741 static const int WXYY = 0x53; |
| 2742 static const int WXYZ = 0x93; |
| 2743 static const int WXYW = 0xD3; |
| 2744 static const int WXZX = 0x23; |
| 2745 static const int WXZY = 0x63; |
| 2746 static const int WXZZ = 0xA3; |
| 2747 static const int WXZW = 0xE3; |
| 2748 static const int WXWX = 0x33; |
| 2749 static const int WXWY = 0x73; |
| 2750 static const int WXWZ = 0xB3; |
| 2751 static const int WXWW = 0xF3; |
| 2752 static const int WYXX = 0x7; |
| 2753 static const int WYXY = 0x47; |
| 2754 static const int WYXZ = 0x87; |
| 2755 static const int WYXW = 0xC7; |
| 2756 static const int WYYX = 0x17; |
| 2757 static const int WYYY = 0x57; |
| 2758 static const int WYYZ = 0x97; |
| 2759 static const int WYYW = 0xD7; |
| 2760 static const int WYZX = 0x27; |
| 2761 static const int WYZY = 0x67; |
| 2762 static const int WYZZ = 0xA7; |
| 2763 static const int WYZW = 0xE7; |
| 2764 static const int WYWX = 0x37; |
| 2765 static const int WYWY = 0x77; |
| 2766 static const int WYWZ = 0xB7; |
| 2767 static const int WYWW = 0xF7; |
| 2768 static const int WZXX = 0xB; |
| 2769 static const int WZXY = 0x4B; |
| 2770 static const int WZXZ = 0x8B; |
| 2771 static const int WZXW = 0xCB; |
| 2772 static const int WZYX = 0x1B; |
| 2773 static const int WZYY = 0x5B; |
| 2774 static const int WZYZ = 0x9B; |
| 2775 static const int WZYW = 0xDB; |
| 2776 static const int WZZX = 0x2B; |
| 2777 static const int WZZY = 0x6B; |
| 2778 static const int WZZZ = 0xAB; |
| 2779 static const int WZZW = 0xEB; |
| 2780 static const int WZWX = 0x3B; |
| 2781 static const int WZWY = 0x7B; |
| 2782 static const int WZWZ = 0xBB; |
| 2783 static const int WZWW = 0xFB; |
| 2784 static const int WWXX = 0xF; |
| 2785 static const int WWXY = 0x4F; |
| 2786 static const int WWXZ = 0x8F; |
| 2787 static const int WWXW = 0xCF; |
| 2788 static const int WWYX = 0x1F; |
| 2789 static const int WWYY = 0x5F; |
| 2790 static const int WWYZ = 0x9F; |
| 2791 static const int WWYW = 0xDF; |
| 2792 static const int WWZX = 0x2F; |
| 2793 static const int WWZY = 0x6F; |
| 2794 static const int WWZZ = 0xAF; |
| 2795 static const int WWZW = 0xEF; |
| 2796 static const int WWWX = 0x3F; |
| 2797 static const int WWWY = 0x7F; |
| 2798 static const int WWWZ = 0xBF; |
| 2799 static const int WWWW = 0xFF; |
| 2800 |
2251 } | 2801 } |
2252 | 2802 |
2253 | 2803 |
2254 class _Int32x4 implements Int32x4 { | 2804 class Int32x4 { |
2255 factory _Int32x4(int x, int y, int z, int w) | 2805 factory Int32x4(int x, int y, int z, int w) |
2256 native "Int32x4_fromInts"; | 2806 native "Int32x4_fromInts"; |
2257 factory _Int32x4.bool(bool x, bool y, bool z, bool w) | 2807 factory Int32x4.bool(bool x, bool y, bool z, bool w) |
2258 native "Int32x4_fromBools"; | 2808 native "Int32x4_fromBools"; |
2259 factory _Int32x4.fromFloat32x4Bits(Float32x4 x) | 2809 factory Int32x4.fromFloat32x4Bits(Float32x4 x) |
2260 native "Int32x4_fromFloat32x4Bits"; | 2810 native "Int32x4_fromFloat32x4Bits"; |
2261 Int32x4 operator |(Int32x4 other) { | 2811 Int32x4 operator |(Int32x4 other) { |
2262 return _or(other); | 2812 return _or(other); |
2263 } | 2813 } |
2264 Int32x4 _or(Int32x4 other) native "Int32x4_or"; | 2814 Int32x4 _or(Int32x4 other) native "Int32x4_or"; |
2265 Int32x4 operator &(Int32x4 other) { | 2815 Int32x4 operator &(Int32x4 other) { |
2266 return _and(other); | 2816 return _and(other); |
2267 } | 2817 } |
2268 Int32x4 _and(Int32x4 other) native "Int32x4_and"; | 2818 Int32x4 _and(Int32x4 other) native "Int32x4_and"; |
2269 Int32x4 operator ^(Int32x4 other) { | 2819 Int32x4 operator ^(Int32x4 other) { |
(...skipping 27 matching lines...) Expand all Loading... |
2297 Int32x4 withFlagY(bool y) native "Int32x4_setFlagY"; | 2847 Int32x4 withFlagY(bool y) native "Int32x4_setFlagY"; |
2298 Int32x4 withFlagZ(bool z) native "Int32x4_setFlagZ"; | 2848 Int32x4 withFlagZ(bool z) native "Int32x4_setFlagZ"; |
2299 Int32x4 withFlagW(bool w) native "Int32x4_setFlagW"; | 2849 Int32x4 withFlagW(bool w) native "Int32x4_setFlagW"; |
2300 Float32x4 select(Float32x4 trueValue, | 2850 Float32x4 select(Float32x4 trueValue, |
2301 Float32x4 falseValue) { | 2851 Float32x4 falseValue) { |
2302 return _select(trueValue, falseValue); | 2852 return _select(trueValue, falseValue); |
2303 } | 2853 } |
2304 Float32x4 _select(Float32x4 trueValue, | 2854 Float32x4 _select(Float32x4 trueValue, |
2305 Float32x4 falseValue) | 2855 Float32x4 falseValue) |
2306 native "Int32x4_select"; | 2856 native "Int32x4_select"; |
| 2857 |
| 2858 /// Mask passed to [shuffle] or [shuffleMix]. |
| 2859 static const int XXXX = 0x0; |
| 2860 static const int XXXY = 0x40; |
| 2861 static const int XXXZ = 0x80; |
| 2862 static const int XXXW = 0xC0; |
| 2863 static const int XXYX = 0x10; |
| 2864 static const int XXYY = 0x50; |
| 2865 static const int XXYZ = 0x90; |
| 2866 static const int XXYW = 0xD0; |
| 2867 static const int XXZX = 0x20; |
| 2868 static const int XXZY = 0x60; |
| 2869 static const int XXZZ = 0xA0; |
| 2870 static const int XXZW = 0xE0; |
| 2871 static const int XXWX = 0x30; |
| 2872 static const int XXWY = 0x70; |
| 2873 static const int XXWZ = 0xB0; |
| 2874 static const int XXWW = 0xF0; |
| 2875 static const int XYXX = 0x4; |
| 2876 static const int XYXY = 0x44; |
| 2877 static const int XYXZ = 0x84; |
| 2878 static const int XYXW = 0xC4; |
| 2879 static const int XYYX = 0x14; |
| 2880 static const int XYYY = 0x54; |
| 2881 static const int XYYZ = 0x94; |
| 2882 static const int XYYW = 0xD4; |
| 2883 static const int XYZX = 0x24; |
| 2884 static const int XYZY = 0x64; |
| 2885 static const int XYZZ = 0xA4; |
| 2886 static const int XYZW = 0xE4; |
| 2887 static const int XYWX = 0x34; |
| 2888 static const int XYWY = 0x74; |
| 2889 static const int XYWZ = 0xB4; |
| 2890 static const int XYWW = 0xF4; |
| 2891 static const int XZXX = 0x8; |
| 2892 static const int XZXY = 0x48; |
| 2893 static const int XZXZ = 0x88; |
| 2894 static const int XZXW = 0xC8; |
| 2895 static const int XZYX = 0x18; |
| 2896 static const int XZYY = 0x58; |
| 2897 static const int XZYZ = 0x98; |
| 2898 static const int XZYW = 0xD8; |
| 2899 static const int XZZX = 0x28; |
| 2900 static const int XZZY = 0x68; |
| 2901 static const int XZZZ = 0xA8; |
| 2902 static const int XZZW = 0xE8; |
| 2903 static const int XZWX = 0x38; |
| 2904 static const int XZWY = 0x78; |
| 2905 static const int XZWZ = 0xB8; |
| 2906 static const int XZWW = 0xF8; |
| 2907 static const int XWXX = 0xC; |
| 2908 static const int XWXY = 0x4C; |
| 2909 static const int XWXZ = 0x8C; |
| 2910 static const int XWXW = 0xCC; |
| 2911 static const int XWYX = 0x1C; |
| 2912 static const int XWYY = 0x5C; |
| 2913 static const int XWYZ = 0x9C; |
| 2914 static const int XWYW = 0xDC; |
| 2915 static const int XWZX = 0x2C; |
| 2916 static const int XWZY = 0x6C; |
| 2917 static const int XWZZ = 0xAC; |
| 2918 static const int XWZW = 0xEC; |
| 2919 static const int XWWX = 0x3C; |
| 2920 static const int XWWY = 0x7C; |
| 2921 static const int XWWZ = 0xBC; |
| 2922 static const int XWWW = 0xFC; |
| 2923 static const int YXXX = 0x1; |
| 2924 static const int YXXY = 0x41; |
| 2925 static const int YXXZ = 0x81; |
| 2926 static const int YXXW = 0xC1; |
| 2927 static const int YXYX = 0x11; |
| 2928 static const int YXYY = 0x51; |
| 2929 static const int YXYZ = 0x91; |
| 2930 static const int YXYW = 0xD1; |
| 2931 static const int YXZX = 0x21; |
| 2932 static const int YXZY = 0x61; |
| 2933 static const int YXZZ = 0xA1; |
| 2934 static const int YXZW = 0xE1; |
| 2935 static const int YXWX = 0x31; |
| 2936 static const int YXWY = 0x71; |
| 2937 static const int YXWZ = 0xB1; |
| 2938 static const int YXWW = 0xF1; |
| 2939 static const int YYXX = 0x5; |
| 2940 static const int YYXY = 0x45; |
| 2941 static const int YYXZ = 0x85; |
| 2942 static const int YYXW = 0xC5; |
| 2943 static const int YYYX = 0x15; |
| 2944 static const int YYYY = 0x55; |
| 2945 static const int YYYZ = 0x95; |
| 2946 static const int YYYW = 0xD5; |
| 2947 static const int YYZX = 0x25; |
| 2948 static const int YYZY = 0x65; |
| 2949 static const int YYZZ = 0xA5; |
| 2950 static const int YYZW = 0xE5; |
| 2951 static const int YYWX = 0x35; |
| 2952 static const int YYWY = 0x75; |
| 2953 static const int YYWZ = 0xB5; |
| 2954 static const int YYWW = 0xF5; |
| 2955 static const int YZXX = 0x9; |
| 2956 static const int YZXY = 0x49; |
| 2957 static const int YZXZ = 0x89; |
| 2958 static const int YZXW = 0xC9; |
| 2959 static const int YZYX = 0x19; |
| 2960 static const int YZYY = 0x59; |
| 2961 static const int YZYZ = 0x99; |
| 2962 static const int YZYW = 0xD9; |
| 2963 static const int YZZX = 0x29; |
| 2964 static const int YZZY = 0x69; |
| 2965 static const int YZZZ = 0xA9; |
| 2966 static const int YZZW = 0xE9; |
| 2967 static const int YZWX = 0x39; |
| 2968 static const int YZWY = 0x79; |
| 2969 static const int YZWZ = 0xB9; |
| 2970 static const int YZWW = 0xF9; |
| 2971 static const int YWXX = 0xD; |
| 2972 static const int YWXY = 0x4D; |
| 2973 static const int YWXZ = 0x8D; |
| 2974 static const int YWXW = 0xCD; |
| 2975 static const int YWYX = 0x1D; |
| 2976 static const int YWYY = 0x5D; |
| 2977 static const int YWYZ = 0x9D; |
| 2978 static const int YWYW = 0xDD; |
| 2979 static const int YWZX = 0x2D; |
| 2980 static const int YWZY = 0x6D; |
| 2981 static const int YWZZ = 0xAD; |
| 2982 static const int YWZW = 0xED; |
| 2983 static const int YWWX = 0x3D; |
| 2984 static const int YWWY = 0x7D; |
| 2985 static const int YWWZ = 0xBD; |
| 2986 static const int YWWW = 0xFD; |
| 2987 static const int ZXXX = 0x2; |
| 2988 static const int ZXXY = 0x42; |
| 2989 static const int ZXXZ = 0x82; |
| 2990 static const int ZXXW = 0xC2; |
| 2991 static const int ZXYX = 0x12; |
| 2992 static const int ZXYY = 0x52; |
| 2993 static const int ZXYZ = 0x92; |
| 2994 static const int ZXYW = 0xD2; |
| 2995 static const int ZXZX = 0x22; |
| 2996 static const int ZXZY = 0x62; |
| 2997 static const int ZXZZ = 0xA2; |
| 2998 static const int ZXZW = 0xE2; |
| 2999 static const int ZXWX = 0x32; |
| 3000 static const int ZXWY = 0x72; |
| 3001 static const int ZXWZ = 0xB2; |
| 3002 static const int ZXWW = 0xF2; |
| 3003 static const int ZYXX = 0x6; |
| 3004 static const int ZYXY = 0x46; |
| 3005 static const int ZYXZ = 0x86; |
| 3006 static const int ZYXW = 0xC6; |
| 3007 static const int ZYYX = 0x16; |
| 3008 static const int ZYYY = 0x56; |
| 3009 static const int ZYYZ = 0x96; |
| 3010 static const int ZYYW = 0xD6; |
| 3011 static const int ZYZX = 0x26; |
| 3012 static const int ZYZY = 0x66; |
| 3013 static const int ZYZZ = 0xA6; |
| 3014 static const int ZYZW = 0xE6; |
| 3015 static const int ZYWX = 0x36; |
| 3016 static const int ZYWY = 0x76; |
| 3017 static const int ZYWZ = 0xB6; |
| 3018 static const int ZYWW = 0xF6; |
| 3019 static const int ZZXX = 0xA; |
| 3020 static const int ZZXY = 0x4A; |
| 3021 static const int ZZXZ = 0x8A; |
| 3022 static const int ZZXW = 0xCA; |
| 3023 static const int ZZYX = 0x1A; |
| 3024 static const int ZZYY = 0x5A; |
| 3025 static const int ZZYZ = 0x9A; |
| 3026 static const int ZZYW = 0xDA; |
| 3027 static const int ZZZX = 0x2A; |
| 3028 static const int ZZZY = 0x6A; |
| 3029 static const int ZZZZ = 0xAA; |
| 3030 static const int ZZZW = 0xEA; |
| 3031 static const int ZZWX = 0x3A; |
| 3032 static const int ZZWY = 0x7A; |
| 3033 static const int ZZWZ = 0xBA; |
| 3034 static const int ZZWW = 0xFA; |
| 3035 static const int ZWXX = 0xE; |
| 3036 static const int ZWXY = 0x4E; |
| 3037 static const int ZWXZ = 0x8E; |
| 3038 static const int ZWXW = 0xCE; |
| 3039 static const int ZWYX = 0x1E; |
| 3040 static const int ZWYY = 0x5E; |
| 3041 static const int ZWYZ = 0x9E; |
| 3042 static const int ZWYW = 0xDE; |
| 3043 static const int ZWZX = 0x2E; |
| 3044 static const int ZWZY = 0x6E; |
| 3045 static const int ZWZZ = 0xAE; |
| 3046 static const int ZWZW = 0xEE; |
| 3047 static const int ZWWX = 0x3E; |
| 3048 static const int ZWWY = 0x7E; |
| 3049 static const int ZWWZ = 0xBE; |
| 3050 static const int ZWWW = 0xFE; |
| 3051 static const int WXXX = 0x3; |
| 3052 static const int WXXY = 0x43; |
| 3053 static const int WXXZ = 0x83; |
| 3054 static const int WXXW = 0xC3; |
| 3055 static const int WXYX = 0x13; |
| 3056 static const int WXYY = 0x53; |
| 3057 static const int WXYZ = 0x93; |
| 3058 static const int WXYW = 0xD3; |
| 3059 static const int WXZX = 0x23; |
| 3060 static const int WXZY = 0x63; |
| 3061 static const int WXZZ = 0xA3; |
| 3062 static const int WXZW = 0xE3; |
| 3063 static const int WXWX = 0x33; |
| 3064 static const int WXWY = 0x73; |
| 3065 static const int WXWZ = 0xB3; |
| 3066 static const int WXWW = 0xF3; |
| 3067 static const int WYXX = 0x7; |
| 3068 static const int WYXY = 0x47; |
| 3069 static const int WYXZ = 0x87; |
| 3070 static const int WYXW = 0xC7; |
| 3071 static const int WYYX = 0x17; |
| 3072 static const int WYYY = 0x57; |
| 3073 static const int WYYZ = 0x97; |
| 3074 static const int WYYW = 0xD7; |
| 3075 static const int WYZX = 0x27; |
| 3076 static const int WYZY = 0x67; |
| 3077 static const int WYZZ = 0xA7; |
| 3078 static const int WYZW = 0xE7; |
| 3079 static const int WYWX = 0x37; |
| 3080 static const int WYWY = 0x77; |
| 3081 static const int WYWZ = 0xB7; |
| 3082 static const int WYWW = 0xF7; |
| 3083 static const int WZXX = 0xB; |
| 3084 static const int WZXY = 0x4B; |
| 3085 static const int WZXZ = 0x8B; |
| 3086 static const int WZXW = 0xCB; |
| 3087 static const int WZYX = 0x1B; |
| 3088 static const int WZYY = 0x5B; |
| 3089 static const int WZYZ = 0x9B; |
| 3090 static const int WZYW = 0xDB; |
| 3091 static const int WZZX = 0x2B; |
| 3092 static const int WZZY = 0x6B; |
| 3093 static const int WZZZ = 0xAB; |
| 3094 static const int WZZW = 0xEB; |
| 3095 static const int WZWX = 0x3B; |
| 3096 static const int WZWY = 0x7B; |
| 3097 static const int WZWZ = 0xBB; |
| 3098 static const int WZWW = 0xFB; |
| 3099 static const int WWXX = 0xF; |
| 3100 static const int WWXY = 0x4F; |
| 3101 static const int WWXZ = 0x8F; |
| 3102 static const int WWXW = 0xCF; |
| 3103 static const int WWYX = 0x1F; |
| 3104 static const int WWYY = 0x5F; |
| 3105 static const int WWYZ = 0x9F; |
| 3106 static const int WWYW = 0xDF; |
| 3107 static const int WWZX = 0x2F; |
| 3108 static const int WWZY = 0x6F; |
| 3109 static const int WWZZ = 0xAF; |
| 3110 static const int WWZW = 0xEF; |
| 3111 static const int WWWX = 0x3F; |
| 3112 static const int WWWY = 0x7F; |
| 3113 static const int WWWZ = 0xBF; |
| 3114 static const int WWWW = 0xFF; |
| 3115 |
2307 } | 3116 } |
2308 | 3117 |
2309 | 3118 |
2310 class _Float64x2 implements Float64x2 { | 3119 class Float64x2 { |
2311 factory _Float64x2(double x, double y) native "Float64x2_fromDoubles"; | 3120 factory Float64x2(double x, double y) native "Float64x2_fromDoubles"; |
2312 factory _Float64x2.splat(double v) native "Float64x2_splat"; | 3121 factory Float64x2.splat(double v) native "Float64x2_splat"; |
2313 factory _Float64x2.zero() native "Float64x2_zero"; | 3122 factory Float64x2.zero() native "Float64x2_zero"; |
2314 factory _Float64x2.fromFloat32x4(Float32x4 v) native "Float64x2_fromFloat32x4"
; | 3123 factory Float64x2.fromFloat32x4(Float32x4 v) native "Float64x2_fromFloat32x4"; |
2315 | 3124 |
2316 Float64x2 operator +(Float64x2 other) { | 3125 Float64x2 operator +(Float64x2 other) { |
2317 return _add(other); | 3126 return _add(other); |
2318 } | 3127 } |
2319 Float64x2 _add(Float64x2 other) native "Float64x2_add"; | 3128 Float64x2 _add(Float64x2 other) native "Float64x2_add"; |
2320 Float64x2 operator -() { | 3129 Float64x2 operator -() { |
2321 return _negate(); | 3130 return _negate(); |
2322 } | 3131 } |
2323 Float64x2 _negate() native "Float64x2_negate"; | 3132 Float64x2 _negate() native "Float64x2_negate"; |
2324 Float64x2 operator -(Float64x2 other) { | 3133 Float64x2 operator -(Float64x2 other) { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2390 _position = _length; | 3199 _position = _length; |
2391 _current = null; | 3200 _current = null; |
2392 return false; | 3201 return false; |
2393 } | 3202 } |
2394 | 3203 |
2395 E get current => _current; | 3204 E get current => _current; |
2396 } | 3205 } |
2397 | 3206 |
2398 | 3207 |
2399 class _TypedListView extends _TypedListBase implements TypedData { | 3208 class _TypedListView extends _TypedListBase implements TypedData { |
2400 _TypedListView(_ByteBuffer _buffer, int _offset, int _length) | 3209 _TypedListView(ByteBuffer _buffer, int _offset, int _length) |
2401 : _typedData = _buffer._data, | 3210 : _typedData = _buffer._data, |
2402 offsetInBytes = _offset, | 3211 offsetInBytes = _offset, |
2403 length = _length { | 3212 length = _length { |
2404 } | 3213 } |
2405 | 3214 |
2406 // Method(s) implementing the TypedData interface. | 3215 // Method(s) implementing the TypedData interface. |
2407 | 3216 |
2408 int get lengthInBytes { | 3217 int get lengthInBytes { |
2409 return length * elementSizeInBytes; | 3218 return length * elementSizeInBytes; |
2410 } | 3219 } |
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3456 } | 4265 } |
3457 } | 4266 } |
3458 | 4267 |
3459 | 4268 |
3460 int _defaultIfNull(object, value) { | 4269 int _defaultIfNull(object, value) { |
3461 if (object == null) { | 4270 if (object == null) { |
3462 return value; | 4271 return value; |
3463 } | 4272 } |
3464 return object; | 4273 return object; |
3465 } | 4274 } |
OLD | NEW |