| 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 part of dart.scalarlist; | 5 part of dart.typeddata; |
| 6 |
| 6 | 7 |
| 7 /** | 8 /** |
| 8 * Interface of Dart Float32x4 and operations. | 9 * Interface of Dart Float32x4 immutable value type and operations. |
| 9 * Float32x4 stores 4 32-bit floating point values in "lanes". | 10 * Float32x4 stores 4 32-bit floating point values in "lanes". |
| 10 * The lanes are "x", "y", "z", and "w" respectively. | 11 * The lanes are "x", "y", "z", and "w" respectively. |
| 11 */ | 12 */ |
| 12 abstract class Float32x4 { | 13 abstract class Float32x4 { |
| 13 external factory Float32x4(double x, double y, double z, double w); | 14 external factory Float32x4(double x, double y, double z, double w); |
| 14 external factory Float32x4.zero(); | 15 external factory Float32x4.zero(); |
| 15 | 16 |
| 16 /// Addition operator. | 17 /// Addition operator. |
| 17 Float32x4 operator+(Float32x4 other); | 18 Float32x4 operator+(Float32x4 other); |
| 18 /// Negate operator. | 19 /// Negate operator. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 32 Uint32x4 greaterThan(Float32x4 other); | 33 Uint32x4 greaterThan(Float32x4 other); |
| 33 /// Relational greater than or equal. | 34 /// Relational greater than or equal. |
| 34 Uint32x4 greaterThanOrEqual(Float32x4 other); | 35 Uint32x4 greaterThanOrEqual(Float32x4 other); |
| 35 /// Relational equal. | 36 /// Relational equal. |
| 36 Uint32x4 equal(Float32x4 other); | 37 Uint32x4 equal(Float32x4 other); |
| 37 /// Relational not-equal. | 38 /// Relational not-equal. |
| 38 Uint32x4 notEqual(Float32x4 other); | 39 Uint32x4 notEqual(Float32x4 other); |
| 39 | 40 |
| 40 /// Returns a copy of [this] each lane being scaled by [s]. | 41 /// Returns a copy of [this] each lane being scaled by [s]. |
| 41 Float32x4 scale(double s); | 42 Float32x4 scale(double s); |
| 42 /// Returns the absolute value of this [Simd128Float32]. | 43 /// Returns the absolute value of this [Float32x4]. |
| 43 Float32x4 abs(); | 44 Float32x4 abs(); |
| 44 /// Clamps [this] to be in the range [lowerLimit]-[upperLimit]. | 45 /// Clamps [this] to be in the range [lowerLimit]-[upperLimit]. |
| 45 Float32x4 clamp(Float32x4 lowerLimit, | 46 Float32x4 clamp(Float32x4 lowerLimit, |
| 46 Float32x4 upperLimit); | 47 Float32x4 upperLimit); |
| 47 | 48 |
| 48 /// Extracted x value. | 49 /// Extracted x value. |
| 49 double get x; | 50 double get x; |
| 50 /// Extracted y value. | 51 /// Extracted y value. |
| 51 double get y; | 52 double get y; |
| 52 /// Extracted z value. | 53 /// Extracted z value. |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 Uint32x4 withFlagW(bool w); | 146 Uint32x4 withFlagW(bool w); |
| 146 | 147 |
| 147 /// Merge [trueValue] and [falseValue] based on [this]' bit mask: | 148 /// Merge [trueValue] and [falseValue] based on [this]' bit mask: |
| 148 /// Select bit from [trueValue] when bit in [this] is on. | 149 /// Select bit from [trueValue] when bit in [this] is on. |
| 149 /// Select bit from [falseValue] when bit in [this] is off. | 150 /// Select bit from [falseValue] when bit in [this] is off. |
| 150 Float32x4 select(Float32x4 trueValue, Float32x4 falseValue); | 151 Float32x4 select(Float32x4 trueValue, Float32x4 falseValue); |
| 151 | 152 |
| 152 /// Returns a bit-wise copy of [this] as a [Float32x4]. | 153 /// Returns a bit-wise copy of [this] as a [Float32x4]. |
| 153 Float32x4 toFloat32x4(); | 154 Float32x4 toFloat32x4(); |
| 154 } | 155 } |
| 155 | |
| 156 /** | |
| 157 * A fixed-length list of Float32x4 numbers that is viewable as a | |
| 158 * [ByteArray]. For long lists, this implementation will be considerably more | |
| 159 * space- and time-efficient than the default [List] implementation. | |
| 160 */ | |
| 161 abstract class Float32x4List implements List<Float32x4>, | |
| 162 ByteArrayViewable { | |
| 163 /** | |
| 164 * Creates a [Simd128Float32List] of the specified length (in elements), | |
| 165 * all of whose elements are initially zero. | |
| 166 */ | |
| 167 external factory Float32x4List(int length); | |
| 168 | |
| 169 /** | |
| 170 * Creates a [Float32x4List] _view_ of the specified region in the | |
| 171 * specified byte [array]. Changes in the [Float32x4List] will be | |
| 172 * visible in the byte array and vice versa. If the [start] index of the | |
| 173 * region is not specified, it defaults to zero (the first byte in the byte | |
| 174 * array). If the length is not specified, it defaults to null, which | |
| 175 * indicates that the view extends to the end of the byte array. | |
| 176 * | |
| 177 * Throws [ArgumentError] if the length of the specified region is not | |
| 178 * divisible by 16 (the size of a "Float32x4" in bytes), or if the | |
| 179 * [start] of the region is not divisible by 16. If, however, [array] is a | |
| 180 * view of another byte array, this constructor will throw [ArgumentError] | |
| 181 * if the implicit starting position in the "ultimately backing" byte array | |
| 182 * is not divisible by 16. In plain terms, this constructor throws | |
| 183 * [ArgumentError] if the specified region does not contain an integral | |
| 184 * number of "Float32x4s," or if it is not "Float32x4-aligned." | |
| 185 */ | |
| 186 external factory Float32x4List.view(ByteArray array, | |
| 187 [int start = 0, int length]); | |
| 188 } | |
| OLD | NEW |