Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
|
kasperl
2013/02/21 11:28:15
2013
Cutch
2013/02/21 18:45:16
Done.
| |
| 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. | |
| 4 | |
| 5 patch class Simd128Float32x4 { | |
|
kasperl
2013/02/21 11:28:15
There are a bunch of long lines in this file. Othe
Cutch
2013/02/21 18:45:16
Done.
| |
| 6 /* patch */ factory Simd128Float32x4(double x, double y, double z, double w) { | |
| 7 return new _Simd128Float32x4(x, y, z, w); | |
| 8 } | |
| 9 /* patch */ factory Simd128Float32x4.zero() { | |
| 10 return new _Simd128Float32x4.zero(); | |
| 11 } | |
| 12 } | |
| 13 | |
| 14 patch class Simd128Mask { | |
| 15 /* patch */ factory Simd128Mask(int x, int y, int z, int w) { | |
| 16 return new _Simd128Mask(x, y, z, w); | |
| 17 } | |
| 18 /* patch */ factory Simd128Mask.bool(bool x, bool y, bool z, bool w) { | |
| 19 return new _Simd128Mask.bool(x, y, z, w); | |
| 20 } | |
| 21 } | |
| 22 | |
| 23 | |
| 24 patch class Simd128Float32x4List { | |
| 25 /* patch */ factory Simd128Float32x4List(int length) { | |
| 26 return new _Simd128Float32x4Array(length); | |
| 27 } | |
| 28 | |
| 29 /* patch */ factory Simd128Float32x4List.transferable(int length) { | |
| 30 return _newTransferable(length); | |
| 31 } | |
| 32 | |
| 33 /* patch */ factory Simd128Float32x4List.view(ByteArray array, | |
| 34 [int start = 0, int length]) { | |
| 35 return new _Simd128Float32x4ArrayView(array, start, length); | |
| 36 } | |
| 37 | |
| 38 static _ExternalSimd128Float32x4Array _newTransferable(int length) | |
| 39 native "Simd128Float32x4List_newTransferable"; | |
| 40 } | |
| 41 | |
| 42 | |
| 43 // Expose native square root. | |
| 44 double _sqrt(double x) native "Math_sqrt"; | |
| 45 class _Simd128Float32x4Dart implements Simd128Float32x4 { | |
| 46 final Float32List _storage = new Float32List(4); | |
| 47 _Simd128Float32x4Dart.empty() { | |
| 48 } | |
| 49 _Simd128Float32x4Dart.copy(Float32List other) { | |
| 50 _storage[0] = other._storage[0]; | |
| 51 _storage[1] = other._storage[1]; | |
| 52 _storage[2] = other._storage[2]; | |
| 53 _storage[3] = other._storage[3]; | |
| 54 } | |
| 55 factory _Simd128Float32x4Dart(double x, double y, double z, double w) { | |
| 56 var instance = new _Simd128Float32x4Dart.empty(); | |
| 57 instance._storage[0] = x; | |
| 58 instance._storage[1] = y; | |
| 59 instance._storage[2] = z; | |
| 60 instance._storage[3] = w; | |
| 61 return instance; | |
| 62 } | |
| 63 factory _Simd128Float32x4Dart.zero() { | |
| 64 var instance = new _Simd128Float32x4Dart.empty(); | |
| 65 return instance; | |
| 66 } | |
| 67 Simd128Float32x4 operator+(Simd128Float32x4 other) { | |
| 68 var instance = new _Simd128Float32x4Dart.copy(this); | |
| 69 instance._storage[0] += other._storage[0]; | |
| 70 instance._storage[1] += other._storage[1]; | |
| 71 instance._storage[2] += other._storage[2]; | |
| 72 instance._storage[3] += other._storage[3]; | |
| 73 return instance; | |
| 74 } | |
| 75 Simd128Float32x4 operator-() { | |
| 76 var instance = new _Simd128Float32x4Dart.copy(this); | |
| 77 instance._storage[0] *= -1.0; | |
| 78 instance._storage[1] *= -1.0; | |
| 79 instance._storage[2] *= -1.0; | |
| 80 instance._storage[3] *= -1.0; | |
| 81 return instance; | |
| 82 } | |
| 83 Simd128Float32x4 operator-(Simd128Float32x4 other) { | |
| 84 var instance = new _Simd128Float32x4Dart.copy(this); | |
| 85 instance._storage[0] -= other._storage[0]; | |
| 86 instance._storage[1] -= other._storage[1]; | |
| 87 instance._storage[2] -= other._storage[2]; | |
| 88 instance._storage[3] -= other._storage[3]; | |
| 89 return instance; | |
| 90 } | |
| 91 Simd128Float32x4 operator*(Simd128Float32x4 other) { | |
| 92 var instance = new _Simd128Float32x4Dart.copy(this); | |
| 93 instance._storage[0] *= other._storage[0]; | |
| 94 instance._storage[1] *= other._storage[1]; | |
| 95 instance._storage[2] *= other._storage[2]; | |
| 96 instance._storage[3] *= other._storage[3]; | |
| 97 return instance; | |
| 98 } | |
| 99 Simd128Float32x4 operator/(Simd128Float32x4 other) { | |
| 100 var instance = new _Simd128Float32x4Dart.copy(this); | |
| 101 instance._storage[0] /= other._storage[0]; | |
| 102 instance._storage[1] /= other._storage[1]; | |
| 103 instance._storage[2] /= other._storage[2]; | |
| 104 instance._storage[3] /= other._storage[3]; | |
| 105 return instance; | |
| 106 } | |
| 107 Simd128Mask lessThan(Simd128Float32x4 other) { | |
| 108 bool _x = _storage[0] < other._storage[0]; | |
| 109 bool _y = _storage[1] < other._storage[1]; | |
| 110 bool _z = _storage[2] < other._storage[2]; | |
| 111 bool _w = _storage[3] < other._storage[3]; | |
| 112 return new Simd128Mask.bool(_x, _y, _z, _w); | |
| 113 } | |
| 114 Simd128Mask lessThanOrEqual(Simd128Float32x4 other) { | |
| 115 bool _x = _storage[0] <= other._storage[0]; | |
| 116 bool _y = _storage[1] <= other._storage[1]; | |
| 117 bool _z = _storage[2] <= other._storage[2]; | |
| 118 bool _w = _storage[3] <= other._storage[3]; | |
| 119 return new Simd128Mask.bool(_x, _y, _z, _w); | |
| 120 } | |
| 121 Simd128Mask greaterThan(Simd128Float32x4 other) { | |
| 122 bool _x = _storage[0] > other._storage[0]; | |
| 123 bool _y = _storage[1] > other._storage[1]; | |
| 124 bool _z = _storage[2] > other._storage[2]; | |
| 125 bool _w = _storage[3] > other._storage[3]; | |
| 126 return new Simd128Mask.bool(_x, _y, _z, _w); | |
| 127 } | |
| 128 Simd128Mask greaterThanOrEqual(Simd128Float32x4 other) { | |
| 129 bool _x = _storage[0] >= other._storage[0]; | |
| 130 bool _y = _storage[1] >= other._storage[1]; | |
| 131 bool _z = _storage[2] >= other._storage[2]; | |
| 132 bool _w = _storage[3] >= other._storage[3]; | |
| 133 return new Simd128Mask.bool(_x, _y, _z, _w); | |
| 134 } | |
| 135 Simd128Mask equal(Simd128Float32x4 other) { | |
| 136 bool _x = _storage[0] == other._storage[0]; | |
| 137 bool _y = _storage[1] == other._storage[1]; | |
| 138 bool _z = _storage[2] == other._storage[2]; | |
| 139 bool _w = _storage[3] == other._storage[3]; | |
| 140 return new Simd128Mask.bool(_x, _y, _z, _w); | |
| 141 } | |
| 142 Simd128Mask notEqual(Simd128Float32x4 other) { | |
| 143 bool _x = _storage[0] != other._storage[0]; | |
| 144 bool _y = _storage[1] != other._storage[1]; | |
| 145 bool _z = _storage[2] != other._storage[2]; | |
| 146 bool _w = _storage[3] != other._storage[3]; | |
| 147 return new Simd128Mask.bool(_x, _y, _z, _w); | |
| 148 } | |
| 149 Simd128Float32x4 scale(double s) { | |
| 150 var instance = new _Simd128Float32x4Dart.copy(this); | |
| 151 instance._storage[0] *= s; | |
| 152 instance._storage[1] *= s; | |
| 153 instance._storage[2] *= s; | |
| 154 instance._storage[3] *= s; | |
| 155 return instance; | |
| 156 } | |
| 157 Simd128Float32x4 abs() { | |
| 158 var instance = new _Simd128Float32x4Dart.copy(this); | |
| 159 instance._storage[0] = instance._storage[0].abs(); | |
| 160 instance._storage[1] = instance._storage[1].abs(); | |
| 161 instance._storage[2] = instance._storage[2].abs(); | |
| 162 instance._storage[3] = instance._storage[3].abs(); | |
| 163 return instance; | |
| 164 } | |
| 165 Simd128Float32x4 clamp(Simd128Float32x4 lowerLimit, Simd128Float32x4 upperLimi t) { | |
| 166 var instance = new _Simd128Float32x4Dart.copy(this); | |
| 167 if (instance._storage[0] > upperLimit._storage[0]) { | |
| 168 instance._storage[0] = upperLimit._storage[0]; | |
| 169 } | |
| 170 if (instance._storage[1] > upperLimit._storage[1]) { | |
| 171 instance._storage[1] = upperLimit._storage[1]; | |
| 172 } | |
| 173 if (instance._storage[2] > upperLimit._storage[2]) { | |
| 174 instance._storage[2] = upperLimit._storage[2]; | |
| 175 } | |
| 176 if (instance._storage[3] > upperLimit._storage[3]) { | |
| 177 instance._storage[3] = upperLimit._storage[3]; | |
| 178 } | |
| 179 if (instance._storage[0] < lowerLimit._storage[0]) { | |
| 180 instance._storage[0] = lowerLimit._storage[0]; | |
| 181 } | |
| 182 if (instance._storage[1] < lowerLimit._storage[1]) { | |
| 183 instance._storage[1] = lowerLimit._storage[1]; | |
| 184 } | |
| 185 if (instance._storage[2] < lowerLimit._storage[2]) { | |
| 186 instance._storage[2] = lowerLimit._storage[2]; | |
| 187 } | |
| 188 if (instance._storage[3] < lowerLimit._storage[3]) { | |
| 189 instance._storage[3] = lowerLimit._storage[3]; | |
| 190 } | |
| 191 return instance; | |
| 192 } | |
| 193 double get x => _storage[0]; | |
| 194 double get y => _storage[1]; | |
| 195 double get z => _storage[2]; | |
| 196 double get w => _storage[3]; | |
| 197 Simd128Float32x4 get xxxx { | |
| 198 var instance = new _Simd128Float32x4Dart.copy(this); | |
| 199 instance._storage[1] = instance._storage[0]; | |
| 200 instance._storage[2] = instance._storage[0]; | |
| 201 instance._storage[3] = instance._storage[0]; | |
| 202 return instance; | |
| 203 } | |
| 204 Simd128Float32x4 get yyyy { | |
| 205 var instance = new _Simd128Float32x4Dart.copy(this); | |
| 206 instance._storage[0] = instance._storage[1]; | |
| 207 instance._storage[2] = instance._storage[1]; | |
| 208 instance._storage[3] = instance._storage[1]; | |
| 209 return instance; | |
| 210 } | |
| 211 Simd128Float32x4 get zzzz { | |
| 212 var instance = new _Simd128Float32x4Dart.copy(this); | |
| 213 instance._storage[0] = instance._storage[2]; | |
| 214 instance._storage[1] = instance._storage[2]; | |
| 215 instance._storage[3] = instance._storage[2]; | |
| 216 return instance; | |
| 217 } | |
| 218 Simd128Float32x4 get wwww { | |
| 219 var instance = new _Simd128Float32x4Dart.copy(this); | |
| 220 instance._storage[0] = instance._storage[3]; | |
| 221 instance._storage[1] = instance._storage[3]; | |
| 222 instance._storage[2] = instance._storage[3]; | |
| 223 return instance; | |
| 224 } | |
| 225 Simd128Float32x4 withX(double x) { | |
| 226 var instance = new _Simd128Float32x4Dart.copy(this); | |
| 227 instance._storage[0] = x; | |
| 228 return instance; | |
| 229 } | |
| 230 Simd128Float32x4 withY(double y) { | |
| 231 var instance = new _Simd128Float32x4Dart.copy(this); | |
| 232 instance._storage[1] = y; | |
| 233 return instance; | |
| 234 } | |
| 235 Simd128Float32x4 withZ(double z) { | |
| 236 var instance = new _Simd128Float32x4Dart.copy(this); | |
| 237 instance._storage[2] = z; | |
| 238 return instance; | |
| 239 } | |
| 240 Simd128Float32x4 withW(double w) { | |
| 241 var instance = new _Simd128Float32x4Dart.copy(this); | |
| 242 instance._storage[3] = w; | |
| 243 return instance; | |
| 244 } | |
| 245 Simd128Float32x4 min(Simd128 other) { | |
| 246 var instance = new _Simd128Float32x4Dart.copy(this); | |
| 247 if (instance._storage[0] > other._storage[0]) { | |
| 248 instance._storage[0] = other._storage[0]; | |
| 249 } | |
| 250 if (instance._storage[1] > other._storage[1]) { | |
| 251 instance._storage[1] = other._storage[1]; | |
| 252 } | |
| 253 if (instance._storage[2] > other._storage[2]) { | |
| 254 instance._storage[2] = other._storage[2]; | |
| 255 } | |
| 256 if (instance._storage[3] > other._storage[3]) { | |
| 257 instance._storage[3] = other._storage[3]; | |
| 258 } | |
| 259 return instance; | |
| 260 } | |
| 261 Simd128Float32x4 max(Simd128 other) { | |
| 262 var instance = new _Simd128Float32x4Dart.copy(this); | |
| 263 if (instance._storage[0] < other._storage[0]) { | |
| 264 instance._storage[0] = other._storage[0]; | |
| 265 } | |
| 266 if (instance._storage[1] < other._storage[1]) { | |
| 267 instance._storage[1] = other._storage[1]; | |
| 268 } | |
| 269 if (instance._storage[2] < other._storage[2]) { | |
| 270 instance._storage[2] = other._storage[2]; | |
| 271 } | |
| 272 if (instance._storage[3] < other._storage[3]) { | |
| 273 instance._storage[3] = other._storage[3]; | |
| 274 } | |
| 275 return instance; | |
| 276 } | |
| 277 Simd128Float32x4 sqrt() { | |
| 278 var instance = new _Simd128Float32x4Dart.copy(this); | |
| 279 instance._storage[0] = _sqrt(instance._storage[0]); | |
| 280 instance._storage[1] = _sqrt(instance._storage[1]); | |
| 281 instance._storage[2] = _sqrt(instance._storage[2]); | |
| 282 instance._storage[3] = _sqrt(instance._storage[3]); | |
| 283 return instance; | |
| 284 } | |
| 285 Simd128Float32x4 reciprocal() { | |
| 286 var instance = new _Simd128Float32x4Dart.copy(this); | |
| 287 instance._storage[0] = (1.0 / instance._storage[0]); | |
| 288 instance._storage[1] = (1.0 / instance._storage[1]); | |
| 289 instance._storage[2] = (1.0 / instance._storage[2]); | |
| 290 instance._storage[3] = (1.0 / instance._storage[3]); | |
| 291 return instance; | |
| 292 } | |
| 293 Simd128Float32x4 reciprocalSqrt() { | |
| 294 var instance = new _Simd128Float32x4Dart.copy(this); | |
| 295 instance._storage[0] = _sqrt(1.0 / instance._storage[0]); | |
| 296 instance._storage[1] = _sqrt(1.0 / instance._storage[1]); | |
| 297 instance._storage[2] = _sqrt(1.0 / instance._storage[2]); | |
| 298 instance._storage[3] = _sqrt(1.0 / instance._storage[3]); | |
| 299 return instance; | |
| 300 } | |
| 301 Simd128Mask toSimd128Mask() { | |
| 302 Uint32List view = new Uint32List.view(_storage.asByteArray()); | |
| 303 return new Simd128Mask(view[0], view[1], view[2], view[3]); | |
| 304 } | |
| 305 } | |
| 306 | |
| 307 class _Simd128MaskDart implements Simd128Mask { | |
| 308 final Uint32List _storage = new Uint32List(4); | |
| 309 _Simd128MaskDart.empty() { | |
| 310 } | |
| 311 _Simd128MaskDart.copy(_Simd128MaskDart other) { | |
| 312 _storage[0] = other._storage[0]; | |
| 313 _storage[1] = other._storage[1]; | |
| 314 _storage[2] = other._storage[2]; | |
| 315 _storage[3] = other._storage[3]; | |
| 316 } | |
| 317 factory _Simd128MaskDart(int x, int y, int z, int w) { | |
| 318 var instance = new _Simd128MaskDart.empty(); | |
| 319 instance._storage[0] = x; | |
| 320 instance._storage[1] = y; | |
| 321 instance._storage[2] = z; | |
| 322 instance._storage[3] = w; | |
| 323 return instance; | |
| 324 } | |
| 325 factory _Simd128MaskDart.bool(bool x, bool y, bool z, bool w) { | |
| 326 var instance = new _Simd128MaskDart.empty(); | |
| 327 instance._storage[0] = x ? 0xFFFFFFFF : 0x0; | |
| 328 instance._storage[1] = y ? 0xFFFFFFFF : 0x0; | |
| 329 instance._storage[2] = z ? 0xFFFFFFFF : 0x0; | |
| 330 instance._storage[3] = w ? 0xFFFFFFFF : 0x0; | |
| 331 return instance; | |
| 332 } | |
| 333 Simd128Mask operator|(Simd128Mask other) { | |
| 334 var instance = new _Simd128MaskDart.copy(this); | |
| 335 instance._storage[0] |= other._storage[0]; | |
| 336 instance._storage[1] |= other._storage[1]; | |
| 337 instance._storage[2] |= other._storage[2]; | |
| 338 instance._storage[3] |= other._storage[3]; | |
| 339 return instance; | |
| 340 } | |
| 341 Simd128Mask operator&(Simd128Mask other) { | |
| 342 var instance = new _Simd128MaskDart.copy(this); | |
| 343 instance._storage[0] &= other._storage[0]; | |
| 344 instance._storage[1] &= other._storage[1]; | |
| 345 instance._storage[2] &= other._storage[2]; | |
| 346 instance._storage[3] &= other._storage[3]; | |
| 347 return instance; | |
| 348 } | |
| 349 Simd128Mask operator^(Simd128Mask other) { | |
| 350 var instance = new _Simd128MaskDart.copy(this); | |
| 351 instance._storage[0] ^= other._storage[0]; | |
| 352 instance._storage[1] ^= other._storage[1]; | |
| 353 instance._storage[2] ^= other._storage[2]; | |
| 354 instance._storage[3] ^= other._storage[3]; | |
| 355 return instance; | |
| 356 } | |
| 357 int get x => _storage[0]; | |
| 358 int get y => _storage[1]; | |
| 359 int get z => _storage[2]; | |
| 360 int get w => _storage[3]; | |
| 361 Simd128Mask withX(int x) { | |
| 362 var instance = new _Simd128MaskDart.copy(this); | |
| 363 instance._storage[0] = x & 0xFFFFFFFF; | |
| 364 return instance; | |
| 365 } | |
| 366 Simd128Mask withY(int y) { | |
| 367 var instance = new _Simd128MaskDart.copy(this); | |
| 368 instance._storage[1] = y & 0xFFFFFFFF; | |
| 369 return instance; | |
| 370 } | |
| 371 Simd128Mask withZ(int z) { | |
| 372 var instance = new _Simd128MaskDart.copy(this); | |
| 373 instance._storage[2] = z & 0xFFFFFFFF; | |
| 374 return instance; | |
| 375 } | |
| 376 Simd128Mask withW(int w) { | |
| 377 var instance = new _Simd128MaskDart.copy(this); | |
| 378 instance._storage[3] = w & 0xFFFFFFFF; | |
| 379 return instance; | |
| 380 } | |
| 381 bool get flagX => _storage[0] != 0x0; | |
| 382 bool get flagY => _storage[1] != 0x0; | |
| 383 bool get flagZ => _storage[2] != 0x0; | |
| 384 bool get flagW => _storage[3] != 0x0; | |
| 385 Simd128Mask withFlagX(bool x) { | |
| 386 var instance = new _Simd128MaskDart.copy(this); | |
| 387 instance._storage[0] = x ? 0xFFFFFFFF : 0x0; | |
| 388 return instance; | |
| 389 } | |
| 390 Simd128Mask withFlagY(bool y) { | |
| 391 var instance = new _Simd128MaskDart.copy(this); | |
| 392 instance._storage[1] = y ? 0xFFFFFFFF : 0x0; | |
| 393 return instance; | |
| 394 } | |
| 395 Simd128Mask withFlagZ(bool z) { | |
| 396 var instance = new _Simd128MaskDart.copy(this); | |
| 397 instance._storage[2] = z ? 0xFFFFFFFF : 0x0; | |
| 398 return instance; | |
| 399 } | |
| 400 Simd128Mask withFlagW(bool w) { | |
| 401 var instance = new _Simd128MaskDart.copy(this); | |
| 402 instance._storage[3] = w ? 0xFFFFFFFF : 0x0; | |
| 403 return instance; | |
| 404 } | |
| 405 Simd128Float32x4 select(Simd128Float32x4 trueValue, Simd128Float32x4 falseValu e) { | |
| 406 Simd128Mask trueMask = trueValue.toSimd128Mask(); | |
| 407 Simd128Mask falseMask = falseValue.toSimd128Mask(); | |
| 408 var instance = new _Simd128MaskDart.empty(); | |
| 409 instance._storage[0] = (_storage[0] & trueMask._storage[0]); | |
| 410 instance._storage[1] = (_storage[1] & trueMask._storage[1]); | |
| 411 instance._storage[2] = (_storage[2] & trueMask._storage[2]); | |
| 412 instance._storage[3] = (_storage[3] & trueMask._storage[3]); | |
| 413 instance._storage[0] |= (~_storage[0] & falseMask._storage[0]); | |
| 414 instance._storage[1] |= (~_storage[1] & falseMask._storage[1]); | |
| 415 instance._storage[2] |= (~_storage[2] & falseMask._storage[2]); | |
| 416 instance._storage[3] |= (~_storage[3] & falseMask._storage[3]); | |
| 417 return instance.toSimd128Float32x4(); | |
| 418 } | |
| 419 Simd128Float32x4 toSimd128Float32x4() { | |
| 420 Float32List view = new Float32List.view(_storage.asByteArray()); | |
| 421 return new Simd128Float32x4(view[0], view[1], view[2], view[3]); | |
| 422 } | |
| 423 } | |
| 424 | |
| 425 class _Simd128Float32x4 implements Simd128Float32x4 { | |
| 426 factory _Simd128Float32x4(double x, double y, double z, double w) | |
| 427 native "Simd128Float32_fromDoubles"; | |
| 428 factory _Simd128Float32x4.zero() native "Simd128Float32_zero"; | |
| 429 Simd128Float32x4 operator+(Simd128Float32x4 other) { | |
| 430 return _add(other); | |
| 431 } | |
| 432 Simd128Float32x4 _add(Simd128Float32x4 other) native "Simd128Float32_add"; | |
| 433 Simd128Float32x4 operator-() { | |
| 434 return _negate(); | |
| 435 } | |
| 436 Simd128Float32x4 _negate() native "Simd128Float32_negate"; | |
| 437 Simd128Float32x4 operator-(Simd128Float32x4 other) { | |
| 438 return _sub(other); | |
| 439 } | |
| 440 Simd128Float32x4 _sub(Simd128Float32x4 other) native "Simd128Float32_sub"; | |
| 441 Simd128Float32x4 operator*(Simd128Float32x4 other) { | |
| 442 return _mul(other); | |
| 443 } | |
| 444 Simd128Float32x4 _mul(Simd128Float32x4 other) native "Simd128Float32_mul"; | |
| 445 Simd128Float32x4 operator/(Simd128Float32x4 other) { | |
| 446 return _div(other); | |
| 447 } | |
| 448 Simd128Float32x4 _div(Simd128Float32x4 other) native "Simd128Float32_div"; | |
| 449 Simd128Mask lessThan(Simd128Float32x4 other) { | |
| 450 return _cmplt(other); | |
| 451 } | |
| 452 Simd128Mask _cmplt(Simd128Float32x4 other) native "Simd128Float32_cmplt"; | |
| 453 Simd128Mask lessThanOrEqual(Simd128Float32x4 other) { | |
| 454 return _cmplte(other); | |
| 455 } | |
| 456 Simd128Mask _cmplte(Simd128Float32x4 other) native "Simd128Float32_cmplte"; | |
| 457 Simd128Mask greaterThan(Simd128Float32x4 other) { | |
| 458 return _cmpgt(other); | |
| 459 } | |
| 460 Simd128Mask _cmpgt(Simd128Float32x4 other) native "Simd128Float32_cmpgt"; | |
| 461 Simd128Mask greaterThanOrEqual(Simd128Float32x4 other) { | |
| 462 return _cmpgte(other); | |
| 463 } | |
| 464 Simd128Mask _cmpgte(Simd128Float32x4 other) native "Simd128Float32_cmpgte"; | |
| 465 Simd128Mask equal(Simd128Float32x4 other) { | |
| 466 return _cmpequal(other); | |
| 467 } | |
| 468 Simd128Mask _cmpequal(Simd128Float32x4 other) | |
| 469 native "Simd128Float32_cmpequal"; | |
| 470 Simd128Mask notEqual(Simd128Float32x4 other) { | |
| 471 return _cmpnequal(other); | |
| 472 } | |
| 473 Simd128Mask _cmpnequal(Simd128Float32x4 other) | |
| 474 native "Simd128Float32_cmpnequal"; | |
| 475 Simd128Float32x4 scale(double s) { | |
| 476 return _scale(s); | |
| 477 } | |
| 478 Simd128Float32x4 _scale(double s) native "Simd128Float32_scale"; | |
| 479 Simd128Float32x4 abs() { | |
| 480 return _abs(); | |
| 481 } | |
| 482 Simd128Float32x4 _abs() native "Simd128Float32_abs"; | |
| 483 Simd128Float32x4 clamp(Simd128Float32x4 lowerLimit, Simd128Float32x4 upperLimi t) { | |
| 484 return _clamp(lowerLimit, upperLimit); | |
| 485 } | |
| 486 Simd128Float32x4 _clamp(Simd128Float32x4 lowerLimit, Simd128Float32x4 upperLim it) | |
| 487 native "Simd128Float32_clamp"; | |
| 488 double get x native "Simd128Float32_getX"; | |
| 489 double get y native "Simd128Float32_getY"; | |
| 490 double get z native "Simd128Float32_getZ"; | |
| 491 double get w native "Simd128Float32_getW"; | |
| 492 Simd128Float32x4 get xxxx native "Simd128Float32_getXXXX"; | |
| 493 Simd128Float32x4 get yyyy native "Simd128Float32_getYYYY"; | |
| 494 Simd128Float32x4 get zzzz native "Simd128Float32_getZZZZ"; | |
| 495 Simd128Float32x4 get wwww native "Simd128Float32_getWWWW"; | |
| 496 Simd128Float32x4 withX(double x) native "Simd128Float32_setX"; | |
| 497 Simd128Float32x4 withY(double y) native "Simd128Float32_setY"; | |
| 498 Simd128Float32x4 withZ(double z) native "Simd128Float32_setZ"; | |
| 499 Simd128Float32x4 withW(double w) native "Simd128Float32_setW"; | |
| 500 Simd128Float32x4 min(Simd128 other) { | |
| 501 return _min(other); | |
| 502 } | |
| 503 Simd128Float32x4 _min(Simd128Float32x4 other) native "Simd128Float32_min"; | |
| 504 Simd128Float32x4 max(Simd128 other) { | |
| 505 return _max(other); | |
| 506 } | |
| 507 Simd128Float32x4 _max(Simd128Float32x4 other) native "Simd128Float32_max"; | |
| 508 Simd128Float32x4 sqrt() { | |
| 509 return _sqrt(); | |
| 510 } | |
| 511 Simd128Float32x4 _sqrt() native "Simd128Float32_sqrt"; | |
| 512 Simd128Float32x4 reciprocal() { | |
| 513 return _reciprocal(); | |
| 514 } | |
| 515 Simd128Float32x4 _reciprocal() native "Simd128Float32_reciprocal"; | |
| 516 Simd128Float32x4 reciprocalSqrt() { | |
| 517 return _reciprocalSqrt(); | |
| 518 } | |
| 519 Simd128Float32x4 _reciprocalSqrt() native "Simd128Float32_reciprocalSqrt"; | |
| 520 Simd128Mask toSimd128Mask() { | |
| 521 return _toSimd128Mask(); | |
| 522 } | |
| 523 Simd128Mask _toSimd128Mask() native "Simd128Float32_toSimd128Mask"; | |
| 524 } | |
| 525 | |
| 526 class _Simd128Mask implements Simd128Mask { | |
| 527 factory _Simd128Mask(int x, int y, int z, int w) | |
| 528 native "Simd128Mask_fromInts"; | |
| 529 factory _Simd128Mask.bool(bool x, bool y, bool z, bool w) | |
| 530 native "Simd128Mask_fromBools"; | |
| 531 Simd128Mask operator|(Simd128Mask other) { | |
| 532 return _or(other); | |
| 533 } | |
| 534 Simd128Mask _or(Simd128Mask other) native "Simd128Mask_or"; | |
| 535 Simd128Mask operator&(Simd128Mask other) { | |
| 536 return _and(other); | |
| 537 } | |
| 538 Simd128Mask _and(Simd128Mask other) native "Simd128Mask_and"; | |
| 539 Simd128Mask operator^(Simd128Mask other) { | |
| 540 return _xor(other); | |
| 541 } | |
| 542 Simd128Mask _xor(Simd128Mask other) native "Simd128Mask_xor"; | |
| 543 int get x native "Simd128Mask_getX"; | |
| 544 int get y native "Simd128Mask_getY"; | |
| 545 int get z native "Simd128Mask_getZ"; | |
| 546 int get w native "Simd128Mask_getW"; | |
| 547 Simd128Mask withX(int x) native "Simd128Mask_setX"; | |
| 548 Simd128Mask withY(int y) native "Simd128Mask_setY"; | |
| 549 Simd128Mask withZ(int z) native "Simd128Mask_setZ"; | |
| 550 Simd128Mask withW(int w) native "Simd128Mask_setW"; | |
| 551 bool get flagX native "Simd128Mask_getFlagX"; | |
| 552 bool get flagY native "Simd128Mask_getFlagY"; | |
| 553 bool get flagZ native "Simd128Mask_getFlagZ"; | |
| 554 bool get flagW native "Simd128Mask_getFlagW"; | |
| 555 Simd128Mask withFlagX(bool x) native "Simd128Mask_setFlagX"; | |
| 556 Simd128Mask withFlagY(bool y) native "Simd128Mask_setFlagY"; | |
| 557 Simd128Mask withFlagZ(bool z) native "Simd128Mask_setFlagZ"; | |
| 558 Simd128Mask withFlagW(bool w) native "Simd128Mask_setFlagW"; | |
| 559 Simd128Float32x4 select(Simd128Float32x4 trueValue, | |
| 560 Simd128Float32x4 falseValue) { | |
| 561 return _select(trueValue, falseValue); | |
| 562 } | |
| 563 Simd128Float32x4 _select(Simd128Float32x4 trueValue, | |
| 564 Simd128Float32x4 falseValue) | |
| 565 native "Simd128Mask_select"; | |
| 566 Simd128Float32x4 toSimd128Float32x4() { | |
| 567 return _toSimd128Float32x4(); | |
| 568 } | |
| 569 Simd128Float32x4 _toSimd128Float32x4() native "Simd128Mask_toSimd128Float32"; | |
| 570 } | |
| 571 | |
| 572 | |
| 573 class _Simd128Float32x4Array extends _ByteArrayBase | |
| 574 implements Simd128Float32x4List { | |
| 575 factory _Simd128Float32x4Array(int length) { | |
| 576 return _new(length); | |
| 577 } | |
| 578 factory _Simd128Float32x4Array.view(ByteArray array, | |
| 579 [int start = 0, int length]) { | |
| 580 if (length == null) { | |
| 581 length = (array.lengthInBytes() - start) ~/ _BYTES_PER_ELEMENT; | |
| 582 } | |
| 583 return new _Simd128Float32x4ArrayView(array, start, length); | |
| 584 } | |
| 585 Simd128Float32x4 operator[](int index) { | |
| 586 return _getIndexed(index); | |
| 587 } | |
| 588 int operator[]=(int index, Simd128Float32x4 value) { | |
| 589 _setIndexed(index, value); | |
| 590 } | |
| 591 Iterator<Simd128Float32x4> get iterator { | |
| 592 return new _ByteArrayIterator<Simd128Float32x4>(this); | |
| 593 } | |
| 594 List<Simd128Float32x4> getRange(int start, int length) { | |
| 595 _rangeCheck(this.length, start, length); | |
| 596 List<Simd128Float32x4> result = _new(length); | |
| 597 result.setRange(0, length, this, start); | |
| 598 return result; | |
| 599 } | |
| 600 void setRange(int start, int length, List<Simd128Float32x4> from, | |
| 601 [int startFrom = 0]) { | |
| 602 if (from is _Simd128Float32x4Array) { | |
| 603 _setRange(start * _BYTES_PER_ELEMENT, | |
| 604 length * _BYTES_PER_ELEMENT, | |
| 605 from, | |
| 606 startFrom * _BYTES_PER_ELEMENT); | |
| 607 } else { | |
| 608 Arrays.copy(from, startFrom, this, start, length); | |
| 609 } | |
| 610 } | |
| 611 String toString() { | |
| 612 return Collections.collectionToString(this); | |
| 613 } | |
| 614 int bytesPerElement() { | |
| 615 return _BYTES_PER_ELEMENT; | |
| 616 } | |
| 617 int lengthInBytes() { | |
| 618 return _length() * _BYTES_PER_ELEMENT; | |
| 619 } | |
| 620 static const int _BYTES_PER_ELEMENT = 16; | |
| 621 static _Simd128Float32x4Array _new(int length) | |
| 622 native "Simd128Float32Array_new"; | |
| 623 Simd128Float32x4 _getIndexed(int index) | |
| 624 native "Simd128Float32Array_getIndexed"; | |
| 625 int _setIndexed(int index, Simd128Float32x4 value) | |
| 626 native "Simd128Float32Array_setIndexed"; | |
| 627 } | |
| 628 | |
| 629 | |
| 630 class _Simd128Float32x4ArrayView extends _ByteArrayViewBase | |
| 631 implements Simd128Float32x4List { | |
| 632 _Simd128Float32x4ArrayView(ByteArray array, | |
| 633 [int offsetInBytes = 0, int _length]) | |
| 634 : super(array, _requireInteger(offsetInBytes), | |
| 635 _requireIntegerOrNull( | |
| 636 _length, | |
| 637 ((array.lengthInBytes() - offsetInBytes) ~/ _BYTES_PER_ELEMENT))) { | |
| 638 _rangeCheck(array.lengthInBytes(), _offset, length * _BYTES_PER_ELEMENT); | |
| 639 } | |
| 640 | |
| 641 Simd128Float32x4 operator[](int index) { | |
| 642 if (index < 0 || index >= length) { | |
| 643 String message = "$index must be in the range [0..$length)"; | |
| 644 throw new RangeError(message); | |
| 645 } | |
| 646 return _array.getSimd128Float32x4(_offset + (index * _BYTES_PER_ELEMENT)); | |
| 647 } | |
| 648 | |
| 649 void operator[]=(int index, Simd128Float32x4 value) { | |
| 650 if (index < 0 || index >= length) { | |
| 651 String message = "$index must be in the range [0..$length)"; | |
| 652 throw new RangeError(message); | |
| 653 } | |
| 654 _array.setSimd128Float32x4(_offset + (index * _BYTES_PER_ELEMENT), value); | |
| 655 } | |
| 656 | |
| 657 Iterator<Simd128Float32x4> get iterator { | |
| 658 return new _ByteArrayIterator<Simd128Float32x4>(this); | |
| 659 } | |
| 660 | |
| 661 List<Simd128Float32x4> getRange(int start, int length) { | |
| 662 _rangeCheck(this.length, start, length); | |
| 663 List<Simd128Float32x4> result = new Float32List(length); | |
| 664 result.setRange(0, length, this, start); | |
| 665 return result; | |
| 666 } | |
| 667 | |
| 668 void setRange(int start, int length, List<Simd128Float32x4> from, | |
| 669 [int startFrom = 0]) { | |
| 670 Arrays.copy(from, startFrom, this, start, length); | |
| 671 } | |
| 672 | |
| 673 String toString() { | |
| 674 return Collections.collectionToString(this); | |
| 675 } | |
| 676 | |
| 677 int bytesPerElement() { | |
| 678 return _BYTES_PER_ELEMENT; | |
| 679 } | |
| 680 | |
| 681 int lengthInBytes() { | |
| 682 return length * _BYTES_PER_ELEMENT; | |
| 683 } | |
| 684 | |
| 685 ByteArray asByteArray([int start = 0, int length]) { | |
| 686 if (length == null) { | |
| 687 length = this.lengthInBytes(); | |
| 688 } | |
| 689 _rangeCheck(this.length, start, length); | |
| 690 return _array.subByteArray(_offset + start, length); | |
| 691 } | |
| 692 | |
| 693 static const int _BYTES_PER_ELEMENT = 16; | |
| 694 } | |
| 695 | |
| 696 | |
| 697 class _ExternalSimd128Float32x4Array extends _ByteArrayBase | |
| 698 implements Simd128Float32x4List { | |
| 699 Simd128Float32x4 operator[](int index) { | |
| 700 return _getIndexed(index); | |
| 701 } | |
| 702 | |
| 703 int operator[]=(int index, Simd128Float32x4 value) { | |
| 704 _setIndexed(index, value); | |
| 705 } | |
| 706 | |
| 707 Iterator<Simd128Float32x4> get iterator { | |
| 708 return new _ByteArrayIterator<Simd128Float32x4>(this); | |
| 709 } | |
| 710 | |
| 711 List<Simd128Float32x4> getRange(int start, int length) { | |
| 712 _rangeCheck(this.length, start, length); | |
| 713 List<Simd128Float32x4> result = new Simd128Float32x4List(length); | |
| 714 result.setRange(0, length, this, start); | |
| 715 return result; | |
| 716 } | |
| 717 | |
| 718 void setRange(int start, int length, List<Simd128Float32x4> from, | |
| 719 [int startFrom = 0]) { | |
| 720 if (from is _ExternalSimd128Float32x4Array) { | |
| 721 _setRange(start * _BYTES_PER_ELEMENT, | |
| 722 length * _BYTES_PER_ELEMENT, | |
| 723 from, | |
| 724 startFrom * _BYTES_PER_ELEMENT); | |
| 725 } else { | |
| 726 Arrays.copy(from, startFrom, this, start, length); | |
| 727 } | |
| 728 } | |
| 729 | |
| 730 String toString() { | |
| 731 return Collections.collectionToString(this); | |
| 732 } | |
| 733 | |
| 734 int bytesPerElement() { | |
| 735 return _BYTES_PER_ELEMENT; | |
| 736 } | |
| 737 | |
| 738 int lengthInBytes() { | |
| 739 return _length() * _BYTES_PER_ELEMENT; | |
| 740 } | |
| 741 | |
| 742 static const int _BYTES_PER_ELEMENT = 16; | |
| 743 | |
| 744 Simd128Float32x4 _getIndexed(int index) | |
| 745 native "ExternalSimd128Float32Array_getIndexed"; | |
| 746 int _setIndexed(int index, Simd128Float32x4 value) | |
| 747 native "ExternalSimd128Float32Array_setIndexed"; | |
| 748 } | |
| OLD | NEW |