mirror of
https://github.com/dart-lang/sdk
synced 2024-10-03 00:29:50 +00:00
Add TypedDataList
superinterface on typed data lists.
Adds an interface which implements both `TypedData` and `List`. That allows abstracting over types that are both `List` and `TypedData` without losing access to one of the interfaces. Tested: typed_data_interface_test.dart Change-Id: Idbdfc084ea5d2d9a072887973e2e9d29a5fd94ce Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371100 Reviewed-by: Martin Kustermann <kustermann@google.com> Commit-Queue: Lasse Nielsen <lrn@google.com> Reviewed-by: Nate Bosch <nbosch@google.com> Reviewed-by: Stephen Adams <sra@google.com>
This commit is contained in:
parent
282893db9e
commit
a505bbc6a0
|
@ -22,7 +22,7 @@
|
||||||
#### `dart:core`
|
#### `dart:core`
|
||||||
|
|
||||||
- **Breaking Change** [#44876][]: `DateTime` on the web platform now stores
|
- **Breaking Change** [#44876][]: `DateTime` on the web platform now stores
|
||||||
microseconds. The web imlementation is now practically compatible with the
|
microseconds. The web implementation is now practically compatible with the
|
||||||
native implementation, where it is possible to round-trip a timestamp in
|
native implementation, where it is possible to round-trip a timestamp in
|
||||||
microseconds through a `DateTime` value without rounding the lower
|
microseconds through a `DateTime` value without rounding the lower
|
||||||
digits. This change might be breaking for apps that rely in some way on the
|
digits. This change might be breaking for apps that rely in some way on the
|
||||||
|
@ -34,6 +34,11 @@
|
||||||
(`add`, `subtract`, `difference`) where the `Duration` argument or result
|
(`add`, `subtract`, `difference`) where the `Duration` argument or result
|
||||||
exceeds 570 years.
|
exceeds 570 years.
|
||||||
|
|
||||||
|
- Added superinterface `TypedDataList` to typed data lists, implementing both
|
||||||
|
`List` and `TypedData`. Allows abstracting over all such lists without losing
|
||||||
|
access to either the `List` or the `TypedData` members.
|
||||||
|
A `ByteData` is still only a `TypedData`, not a list.
|
||||||
|
|
||||||
[#44876]: https://github.com/dart-lang/sdk/issues/44876
|
[#44876]: https://github.com/dart-lang/sdk/issues/44876
|
||||||
|
|
||||||
#### `dart:typed_data`
|
#### `dart:typed_data`
|
||||||
|
|
|
@ -31,6 +31,7 @@ const List<String> denylistedTypedDataClasses = [
|
||||||
"Int64List",
|
"Int64List",
|
||||||
"Int8List",
|
"Int8List",
|
||||||
"TypedData",
|
"TypedData",
|
||||||
|
"TypedDataList",
|
||||||
"Uint16List",
|
"Uint16List",
|
||||||
"Uint32List",
|
"Uint32List",
|
||||||
"Uint64List",
|
"Uint64List",
|
||||||
|
|
|
@ -206,7 +206,7 @@ abstract final class _TypedListBase {
|
||||||
int start, int count, _TypedListBase from, int skipCount);
|
int start, int count, _TypedListBase from, int skipCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
base mixin _IntListMixin on _TypedListBase implements List<int> {
|
base mixin _IntListMixin on _TypedListBase implements TypedDataList<int> {
|
||||||
int get elementSizeInBytes;
|
int get elementSizeInBytes;
|
||||||
int get offsetInBytes;
|
int get offsetInBytes;
|
||||||
_ByteBuffer get buffer;
|
_ByteBuffer get buffer;
|
||||||
|
@ -540,7 +540,7 @@ base mixin _TypedIntListMixin<SpawnedType extends List<int>> on _IntListMixin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
base mixin _DoubleListMixin on _TypedListBase implements List<double> {
|
base mixin _DoubleListMixin on _TypedListBase implements TypedDataList<double> {
|
||||||
int get elementSizeInBytes;
|
int get elementSizeInBytes;
|
||||||
int get offsetInBytes;
|
int get offsetInBytes;
|
||||||
_ByteBuffer get buffer;
|
_ByteBuffer get buffer;
|
||||||
|
@ -878,7 +878,8 @@ base mixin _TypedDoubleListMixin<SpawnedType extends List<double>>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
base mixin _Float32x4ListMixin on _TypedListBase implements List<Float32x4> {
|
base mixin _Float32x4ListMixin on _TypedListBase
|
||||||
|
implements TypedDataList<Float32x4> {
|
||||||
int get elementSizeInBytes;
|
int get elementSizeInBytes;
|
||||||
int get offsetInBytes;
|
int get offsetInBytes;
|
||||||
_ByteBuffer get buffer;
|
_ByteBuffer get buffer;
|
||||||
|
@ -1216,7 +1217,8 @@ base mixin _Float32x4ListMixin on _TypedListBase implements List<Float32x4> {
|
||||||
_setRange(start, end, from, skipCount);
|
_setRange(start, end, from, skipCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
base mixin _Int32x4ListMixin on _TypedListBase implements List<Int32x4> {
|
base mixin _Int32x4ListMixin on _TypedListBase
|
||||||
|
implements TypedDataList<Int32x4> {
|
||||||
int get elementSizeInBytes;
|
int get elementSizeInBytes;
|
||||||
int get offsetInBytes;
|
int get offsetInBytes;
|
||||||
_ByteBuffer get buffer;
|
_ByteBuffer get buffer;
|
||||||
|
@ -1553,7 +1555,8 @@ base mixin _Int32x4ListMixin on _TypedListBase implements List<Int32x4> {
|
||||||
_setRange(start, end, from, skipCount);
|
_setRange(start, end, from, skipCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
base mixin _Float64x2ListMixin on _TypedListBase implements List<Float64x2> {
|
base mixin _Float64x2ListMixin on _TypedListBase
|
||||||
|
implements TypedDataList<Float64x2> {
|
||||||
int get elementSizeInBytes;
|
int get elementSizeInBytes;
|
||||||
int get offsetInBytes;
|
int get offsetInBytes;
|
||||||
_ByteBuffer get buffer;
|
_ByteBuffer get buffer;
|
||||||
|
|
|
@ -1444,11 +1444,7 @@ mixin _TypedListCommonOperationsMixin {
|
||||||
String toString() => ListBase.listToString(this as List);
|
String toString() => ListBase.listToString(this as List);
|
||||||
}
|
}
|
||||||
|
|
||||||
mixin _IntListMixin implements List<int> {
|
mixin _IntListMixin implements TypedDataList<int> {
|
||||||
int get elementSizeInBytes;
|
|
||||||
int get offsetInBytes;
|
|
||||||
ByteBuffer get buffer;
|
|
||||||
|
|
||||||
Iterable<T> whereType<T>() => WhereTypeIterable<T>(this);
|
Iterable<T> whereType<T>() => WhereTypeIterable<T>(this);
|
||||||
|
|
||||||
Iterable<int> followedBy(Iterable<int> other) =>
|
Iterable<int> followedBy(Iterable<int> other) =>
|
||||||
|
@ -1720,8 +1716,8 @@ mixin _IntListMixin implements List<int> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mixin _TypedIntListMixin<SpawnedType extends List<int>> on _IntListMixin
|
mixin _TypedIntListMixin<SpawnedType extends TypedDataList<int>>
|
||||||
implements List<int> {
|
on _IntListMixin {
|
||||||
SpawnedType _createList(int length);
|
SpawnedType _createList(int length);
|
||||||
|
|
||||||
void setRange(int start, int end, Iterable<int> from, [int skipCount = 0]) {
|
void setRange(int start, int end, Iterable<int> from, [int skipCount = 0]) {
|
||||||
|
@ -1743,7 +1739,7 @@ mixin _TypedIntListMixin<SpawnedType extends List<int>> on _IntListMixin
|
||||||
if (from is TypedData) {
|
if (from is TypedData) {
|
||||||
// We only add this mixin to typed lists in this library so we know
|
// We only add this mixin to typed lists in this library so we know
|
||||||
// `this` is `TypedData`.
|
// `this` is `TypedData`.
|
||||||
final TypedData destTypedData = unsafeCast<TypedData>(this);
|
final TypedData destTypedData = this;
|
||||||
final TypedData fromTypedData = unsafeCast<TypedData>(from);
|
final TypedData fromTypedData = unsafeCast<TypedData>(from);
|
||||||
|
|
||||||
final ByteBuffer destBuffer = destTypedData.buffer;
|
final ByteBuffer destBuffer = destTypedData.buffer;
|
||||||
|
@ -1761,7 +1757,7 @@ mixin _TypedIntListMixin<SpawnedType extends List<int>> on _IntListMixin
|
||||||
//
|
//
|
||||||
// 1. Dart array element types are the same.
|
// 1. Dart array element types are the same.
|
||||||
// 2. Wasm array element sizes are the same.
|
// 2. Wasm array element sizes are the same.
|
||||||
// 3. Source and destinaton offsets are multiples of element size.
|
// 3. Source and destination offsets are multiples of element size.
|
||||||
//
|
//
|
||||||
// (1) is to make sure no sign extension, clamping, or truncation needs
|
// (1) is to make sure no sign extension, clamping, or truncation needs
|
||||||
// to happen when copying. (2) and (3) are requirements for `array.copy`.
|
// to happen when copying. (2) and (3) are requirements for `array.copy`.
|
||||||
|
@ -1841,11 +1837,7 @@ mixin _TypedIntListMixin<SpawnedType extends List<int>> on _IntListMixin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mixin _DoubleListMixin implements List<double> {
|
mixin _DoubleListMixin implements TypedDataList<double> {
|
||||||
int get elementSizeInBytes;
|
|
||||||
int get offsetInBytes;
|
|
||||||
ByteBuffer get buffer;
|
|
||||||
|
|
||||||
Iterable<T> whereType<T>() => WhereTypeIterable<T>(this);
|
Iterable<T> whereType<T>() => WhereTypeIterable<T>(this);
|
||||||
|
|
||||||
Iterable<double> followedBy(Iterable<double> other) =>
|
Iterable<double> followedBy(Iterable<double> other) =>
|
||||||
|
@ -2119,8 +2111,8 @@ mixin _DoubleListMixin implements List<double> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mixin _TypedDoubleListMixin<SpawnedType extends List<double>>
|
mixin _TypedDoubleListMixin<SpawnedType extends TypedDataList<double>>
|
||||||
on _DoubleListMixin implements List<double> {
|
on _DoubleListMixin {
|
||||||
SpawnedType _createList(int length);
|
SpawnedType _createList(int length);
|
||||||
|
|
||||||
void setRange(int start, int end, Iterable<double> from,
|
void setRange(int start, int end, Iterable<double> from,
|
||||||
|
@ -2141,10 +2133,10 @@ mixin _TypedDoubleListMixin<SpawnedType extends List<double>>
|
||||||
|
|
||||||
if (count == 0) return;
|
if (count == 0) return;
|
||||||
|
|
||||||
if (this is TypedData && from is TypedData) {
|
if (from is TypedData) {
|
||||||
// We only add this mixin to typed lists in this library so we know
|
// We only add this mixin to typed lists in this library so we know
|
||||||
// `this` is `TypedData`.
|
// `this` is `TypedData`.
|
||||||
final TypedData destTypedData = unsafeCast<TypedData>(this);
|
final TypedData destTypedData = this;
|
||||||
final TypedData fromTypedData = unsafeCast<TypedData>(from);
|
final TypedData fromTypedData = unsafeCast<TypedData>(from);
|
||||||
|
|
||||||
final ByteBuffer destBuffer = destTypedData.buffer;
|
final ByteBuffer destBuffer = destTypedData.buffer;
|
||||||
|
|
|
@ -24,9 +24,9 @@ export "dart:_internal" show BytesBuilder;
|
||||||
/// more efficiently using a typed view.
|
/// more efficiently using a typed view.
|
||||||
///
|
///
|
||||||
/// It is a compile-time error for a class to attempt to extend or implement
|
/// It is a compile-time error for a class to attempt to extend or implement
|
||||||
/// ByteBuffer.
|
/// `ByteBuffer`.
|
||||||
abstract final class ByteBuffer {
|
abstract final class ByteBuffer {
|
||||||
/// Returns the length of this byte buffer, in bytes.
|
/// The length of this byte buffer, in bytes.
|
||||||
int get lengthInBytes;
|
int get lengthInBytes;
|
||||||
|
|
||||||
/// Creates a [Uint8List] _view_ of a region of this byte buffer.
|
/// Creates a [Uint8List] _view_ of a region of this byte buffer.
|
||||||
|
@ -343,24 +343,26 @@ abstract final class ByteBuffer {
|
||||||
/// A typed view of a sequence of bytes.
|
/// A typed view of a sequence of bytes.
|
||||||
///
|
///
|
||||||
/// It is a compile-time error for a class to attempt to extend or implement
|
/// It is a compile-time error for a class to attempt to extend or implement
|
||||||
/// TypedData.
|
/// `TypedData`.
|
||||||
abstract final class TypedData {
|
abstract final class TypedData {
|
||||||
/// Returns the number of bytes in the representation of each element in this
|
/// The number of bytes in the representation of each element in this list.
|
||||||
/// list.
|
|
||||||
int get elementSizeInBytes;
|
int get elementSizeInBytes;
|
||||||
|
|
||||||
/// Returns the offset in bytes into the underlying byte buffer of this view.
|
/// The offset of this view into the underlying byte buffer, in bytes.
|
||||||
int get offsetInBytes;
|
int get offsetInBytes;
|
||||||
|
|
||||||
/// Returns the length of this view, in bytes.
|
/// The length of this view, in bytes.
|
||||||
int get lengthInBytes;
|
int get lengthInBytes;
|
||||||
|
|
||||||
/// Returns the byte buffer associated with this object.
|
/// The byte buffer associated with this object.
|
||||||
ByteBuffer get buffer;
|
ByteBuffer get buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract final class _TypedIntList extends TypedData {
|
/// A [TypedData] fixed-length [List]-view on the bytes of [buffer].
|
||||||
/// Returns the concatenation of this list and [other].
|
abstract final class TypedDataList<E> implements TypedData, List<E> {}
|
||||||
|
|
||||||
|
abstract final class _TypedIntList implements TypedDataList<int> {
|
||||||
|
/// The concatenation of this list and [other].
|
||||||
///
|
///
|
||||||
/// If other is also a typed-data integer list, the returned list will
|
/// If other is also a typed-data integer list, the returned list will
|
||||||
/// be a type-data integer list capable of containing all the elements of
|
/// be a type-data integer list capable of containing all the elements of
|
||||||
|
@ -369,8 +371,8 @@ abstract final class _TypedIntList extends TypedData {
|
||||||
List<int> operator +(List<int> other);
|
List<int> operator +(List<int> other);
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract final class _TypedFloatList extends TypedData {
|
abstract final class _TypedFloatList implements TypedDataList<double> {
|
||||||
/// Returns the concatenation of this list and [other].
|
/// The concatenation of this list and [other].
|
||||||
///
|
///
|
||||||
/// If other is also a typed-data floating point number list,
|
/// If other is also a typed-data floating point number list,
|
||||||
/// the returned list will be a type-data float list capable of containing
|
/// the returned list will be a type-data float list capable of containing
|
||||||
|
@ -379,11 +381,23 @@ abstract final class _TypedFloatList extends TypedData {
|
||||||
List<double> operator +(List<double> other);
|
List<double> operator +(List<double> other);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Describes endianness to be used when accessing or updating a
|
/// Endianness of number representation.
|
||||||
/// sequence of bytes.
|
///
|
||||||
|
/// The order of bytes in memory of a number representation, with
|
||||||
|
/// [little] endian having the least significant byte first, and [big] endian
|
||||||
|
/// (aka. network byte order) having the most significant byte first.
|
||||||
|
///
|
||||||
|
/// The [host] endian is the native endianness of the underlying platform,
|
||||||
|
/// and the default endianness used by typed-data lists, like [Uint16List],
|
||||||
|
/// on this platform. Always one of [little] or [big] endian.
|
||||||
|
///
|
||||||
|
/// Can be specified when accessing or updating a sequence of bytes using a
|
||||||
|
/// [ByteData] view. The host endianness can be used if accessing larger
|
||||||
|
/// numbers by their bytes, for example through a [Uint8List] view on
|
||||||
|
/// a buffer written using an [Int64List] view of the same buffer..
|
||||||
///
|
///
|
||||||
/// It is a compile-time error for a class to attempt to extend or implement
|
/// It is a compile-time error for a class to attempt to extend or implement
|
||||||
/// Endian.
|
/// `Endian`.
|
||||||
final class Endian {
|
final class Endian {
|
||||||
final bool _littleEndian;
|
final bool _littleEndian;
|
||||||
const Endian._(this._littleEndian);
|
const Endian._(this._littleEndian);
|
||||||
|
@ -415,7 +429,6 @@ final class Endian {
|
||||||
/// if (blob.getUint32(0, Endian.little) == 0x04034b50) { // Zip file marker
|
/// if (blob.getUint32(0, Endian.little) == 0x04034b50) { // Zip file marker
|
||||||
/// ...
|
/// ...
|
||||||
/// }
|
/// }
|
||||||
///
|
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// Finally, `ByteData` may be used to intentionally reinterpret the bytes
|
/// Finally, `ByteData` may be used to intentionally reinterpret the bytes
|
||||||
|
@ -430,7 +443,7 @@ final class Endian {
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// It is a compile-time error for a class to attempt to extend or implement
|
/// It is a compile-time error for a class to attempt to extend or implement
|
||||||
/// ByteData.
|
/// `ByteData`.
|
||||||
abstract final class ByteData implements TypedData {
|
abstract final class ByteData implements TypedData {
|
||||||
/// Creates a [ByteData] of the specified length (in elements), all of
|
/// Creates a [ByteData] of the specified length (in elements), all of
|
||||||
/// whose bytes are initially zero.
|
/// whose bytes are initially zero.
|
||||||
|
@ -500,7 +513,7 @@ abstract final class ByteData implements TypedData {
|
||||||
@Since("3.3")
|
@Since("3.3")
|
||||||
ByteData asUnmodifiableView();
|
ByteData asUnmodifiableView();
|
||||||
|
|
||||||
/// Returns the (possibly negative) integer represented by the byte at the
|
/// The (possibly negative) integer represented by the byte at the
|
||||||
/// specified [byteOffset] in this object, in two's complement binary
|
/// specified [byteOffset] in this object, in two's complement binary
|
||||||
/// representation.
|
/// representation.
|
||||||
///
|
///
|
||||||
|
@ -520,7 +533,7 @@ abstract final class ByteData implements TypedData {
|
||||||
/// less than the length of this object.
|
/// less than the length of this object.
|
||||||
void setInt8(int byteOffset, int value);
|
void setInt8(int byteOffset, int value);
|
||||||
|
|
||||||
/// Returns the positive integer represented by the byte at the specified
|
/// The positive integer represented by the byte at the specified
|
||||||
/// [byteOffset] in this object, in unsigned binary form.
|
/// [byteOffset] in this object, in unsigned binary form.
|
||||||
///
|
///
|
||||||
/// The return value will be between 0 and 255, inclusive.
|
/// The return value will be between 0 and 255, inclusive.
|
||||||
|
@ -539,7 +552,7 @@ abstract final class ByteData implements TypedData {
|
||||||
/// less than the length of this object.
|
/// less than the length of this object.
|
||||||
void setUint8(int byteOffset, int value);
|
void setUint8(int byteOffset, int value);
|
||||||
|
|
||||||
/// Returns the (possibly negative) integer represented by the two bytes at
|
/// The (possibly negative) integer represented by the two bytes at
|
||||||
/// the specified [byteOffset] in this object, in two's complement binary
|
/// the specified [byteOffset] in this object, in two's complement binary
|
||||||
/// form.
|
/// form.
|
||||||
///
|
///
|
||||||
|
@ -561,7 +574,7 @@ abstract final class ByteData implements TypedData {
|
||||||
/// `byteOffset + 2` must be less than or equal to the length of this object.
|
/// `byteOffset + 2` must be less than or equal to the length of this object.
|
||||||
void setInt16(int byteOffset, int value, [Endian endian = Endian.big]);
|
void setInt16(int byteOffset, int value, [Endian endian = Endian.big]);
|
||||||
|
|
||||||
/// Returns the positive integer represented by the two bytes starting
|
/// The positive integer represented by the two bytes starting
|
||||||
/// at the specified [byteOffset] in this object, in unsigned binary
|
/// at the specified [byteOffset] in this object, in unsigned binary
|
||||||
/// form.
|
/// form.
|
||||||
///
|
///
|
||||||
|
@ -582,7 +595,7 @@ abstract final class ByteData implements TypedData {
|
||||||
/// `byteOffset + 2` must be less than or equal to the length of this object.
|
/// `byteOffset + 2` must be less than or equal to the length of this object.
|
||||||
void setUint16(int byteOffset, int value, [Endian endian = Endian.big]);
|
void setUint16(int byteOffset, int value, [Endian endian = Endian.big]);
|
||||||
|
|
||||||
/// Returns the (possibly negative) integer represented by the four bytes at
|
/// The (possibly negative) integer represented by the four bytes at
|
||||||
/// the specified [byteOffset] in this object, in two's complement binary
|
/// the specified [byteOffset] in this object, in two's complement binary
|
||||||
/// form.
|
/// form.
|
||||||
///
|
///
|
||||||
|
@ -604,7 +617,7 @@ abstract final class ByteData implements TypedData {
|
||||||
/// `byteOffset + 4` must be less than or equal to the length of this object.
|
/// `byteOffset + 4` must be less than or equal to the length of this object.
|
||||||
void setInt32(int byteOffset, int value, [Endian endian = Endian.big]);
|
void setInt32(int byteOffset, int value, [Endian endian = Endian.big]);
|
||||||
|
|
||||||
/// Returns the positive integer represented by the four bytes starting
|
/// The positive integer represented by the four bytes starting
|
||||||
/// at the specified [byteOffset] in this object, in unsigned binary
|
/// at the specified [byteOffset] in this object, in unsigned binary
|
||||||
/// form.
|
/// form.
|
||||||
///
|
///
|
||||||
|
@ -625,7 +638,7 @@ abstract final class ByteData implements TypedData {
|
||||||
/// `byteOffset + 4` must be less than or equal to the length of this object.
|
/// `byteOffset + 4` must be less than or equal to the length of this object.
|
||||||
void setUint32(int byteOffset, int value, [Endian endian = Endian.big]);
|
void setUint32(int byteOffset, int value, [Endian endian = Endian.big]);
|
||||||
|
|
||||||
/// Returns the (possibly negative) integer represented by the eight bytes at
|
/// The (possibly negative) integer represented by the eight bytes at
|
||||||
/// the specified [byteOffset] in this object, in two's complement binary
|
/// the specified [byteOffset] in this object, in two's complement binary
|
||||||
/// form.
|
/// form.
|
||||||
///
|
///
|
||||||
|
@ -647,7 +660,7 @@ abstract final class ByteData implements TypedData {
|
||||||
/// `byteOffset + 8` must be less than or equal to the length of this object.
|
/// `byteOffset + 8` must be less than or equal to the length of this object.
|
||||||
void setInt64(int byteOffset, int value, [Endian endian = Endian.big]);
|
void setInt64(int byteOffset, int value, [Endian endian = Endian.big]);
|
||||||
|
|
||||||
/// Returns the positive integer represented by the eight bytes starting
|
/// The positive integer represented by the eight bytes starting
|
||||||
/// at the specified [byteOffset] in this object, in unsigned binary
|
/// at the specified [byteOffset] in this object, in unsigned binary
|
||||||
/// form.
|
/// form.
|
||||||
///
|
///
|
||||||
|
@ -668,7 +681,7 @@ abstract final class ByteData implements TypedData {
|
||||||
/// `byteOffset + 8` must be less than or equal to the length of this object.
|
/// `byteOffset + 8` must be less than or equal to the length of this object.
|
||||||
void setUint64(int byteOffset, int value, [Endian endian = Endian.big]);
|
void setUint64(int byteOffset, int value, [Endian endian = Endian.big]);
|
||||||
|
|
||||||
/// Returns the floating point number represented by the four bytes at
|
/// The floating point number represented by the four bytes at
|
||||||
/// the specified [byteOffset] in this object, in IEEE 754
|
/// the specified [byteOffset] in this object, in IEEE 754
|
||||||
/// single-precision binary floating-point format (binary32).
|
/// single-precision binary floating-point format (binary32).
|
||||||
///
|
///
|
||||||
|
@ -693,7 +706,7 @@ abstract final class ByteData implements TypedData {
|
||||||
/// `byteOffset + 4` must be less than or equal to the length of this object.
|
/// `byteOffset + 4` must be less than or equal to the length of this object.
|
||||||
void setFloat32(int byteOffset, double value, [Endian endian = Endian.big]);
|
void setFloat32(int byteOffset, double value, [Endian endian = Endian.big]);
|
||||||
|
|
||||||
/// Returns the floating point number represented by the eight bytes at
|
/// The floating point number represented by the eight bytes at
|
||||||
/// the specified [byteOffset] in this object, in IEEE 754
|
/// the specified [byteOffset] in this object, in IEEE 754
|
||||||
/// double-precision binary floating-point format (binary64).
|
/// double-precision binary floating-point format (binary64).
|
||||||
///
|
///
|
||||||
|
@ -720,8 +733,8 @@ abstract final class ByteData implements TypedData {
|
||||||
/// range -128 to +127.
|
/// range -128 to +127.
|
||||||
///
|
///
|
||||||
/// It is a compile-time error for a class to attempt to extend or implement
|
/// It is a compile-time error for a class to attempt to extend or implement
|
||||||
/// Int8List.
|
/// `Int8List`.
|
||||||
abstract final class Int8List implements List<int>, _TypedIntList {
|
abstract final class Int8List implements _TypedIntList {
|
||||||
/// Creates an [Int8List] of the specified length (in elements), all of
|
/// Creates an [Int8List] of the specified length (in elements), all of
|
||||||
/// whose elements are initially zero.
|
/// whose elements are initially zero.
|
||||||
///
|
///
|
||||||
|
@ -801,7 +814,7 @@ abstract final class Int8List implements List<int>, _TypedIntList {
|
||||||
@Since("3.3")
|
@Since("3.3")
|
||||||
Int8List asUnmodifiableView();
|
Int8List asUnmodifiableView();
|
||||||
|
|
||||||
/// Returns a new list containing the elements between [start] and [end].
|
/// Creates a new list containing the elements between [start] and [end].
|
||||||
///
|
///
|
||||||
/// The new list is an `Int8List` containing the elements of this list at
|
/// The new list is an `Int8List` containing the elements of this list at
|
||||||
/// positions greater than or equal to [start] and less than [end] in the same
|
/// positions greater than or equal to [start] and less than [end] in the same
|
||||||
|
@ -820,7 +833,7 @@ abstract final class Int8List implements List<int>, _TypedIntList {
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// The `start` and `end` positions must satisfy the relations
|
/// The `start` and `end` positions must satisfy the relations
|
||||||
/// 0 ≤ `start` ≤ `end` ≤ `this.length`
|
/// 0 ≤ `start` ≤ `end` ≤ `this.length`.
|
||||||
/// If `end` is equal to `start`, then the returned list is empty.
|
/// If `end` is equal to `start`, then the returned list is empty.
|
||||||
Int8List sublist(int start, [int? end]);
|
Int8List sublist(int start, [int? end]);
|
||||||
|
|
||||||
|
@ -837,8 +850,8 @@ abstract final class Int8List implements List<int>, _TypedIntList {
|
||||||
/// range 0 to 255.
|
/// range 0 to 255.
|
||||||
///
|
///
|
||||||
/// It is a compile-time error for a class to attempt to extend or implement
|
/// It is a compile-time error for a class to attempt to extend or implement
|
||||||
/// Uint8List.
|
/// `Uint8List`.
|
||||||
abstract final class Uint8List implements List<int>, _TypedIntList {
|
abstract final class Uint8List implements _TypedIntList {
|
||||||
/// Creates a [Uint8List] of the specified length (in elements), all of
|
/// Creates a [Uint8List] of the specified length (in elements), all of
|
||||||
/// whose elements are initially zero.
|
/// whose elements are initially zero.
|
||||||
///
|
///
|
||||||
|
@ -925,7 +938,7 @@ abstract final class Uint8List implements List<int>, _TypedIntList {
|
||||||
/// the elements of [other], otherwise it'll be a normal list of integers.
|
/// the elements of [other], otherwise it'll be a normal list of integers.
|
||||||
List<int> operator +(List<int> other);
|
List<int> operator +(List<int> other);
|
||||||
|
|
||||||
/// Returns a new list containing the elements between [start] and [end].
|
/// Creates a new list containing the elements between [start] and [end].
|
||||||
///
|
///
|
||||||
/// The new list is a `Uint8List` containing the elements of this list at
|
/// The new list is a `Uint8List` containing the elements of this list at
|
||||||
/// positions greater than or equal to [start] and less than [end] in the same
|
/// positions greater than or equal to [start] and less than [end] in the same
|
||||||
|
@ -944,7 +957,7 @@ abstract final class Uint8List implements List<int>, _TypedIntList {
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// The `start` and `end` positions must satisfy the relations
|
/// The `start` and `end` positions must satisfy the relations
|
||||||
/// 0 ≤ `start` ≤ `end` ≤ `this.length`
|
/// 0 ≤ `start` ≤ `end` ≤ `this.length`.
|
||||||
/// If `end` is equal to `start`, then the returned list is empty.
|
/// If `end` is equal to `start`, then the returned list is empty.
|
||||||
Uint8List sublist(int start, [int? end]);
|
Uint8List sublist(int start, [int? end]);
|
||||||
|
|
||||||
|
@ -961,8 +974,8 @@ abstract final class Uint8List implements List<int>, _TypedIntList {
|
||||||
/// and all values above 255 are stored as 255.
|
/// and all values above 255 are stored as 255.
|
||||||
///
|
///
|
||||||
/// It is a compile-time error for a class to attempt to extend or implement
|
/// It is a compile-time error for a class to attempt to extend or implement
|
||||||
/// Uint8ClampedList.
|
/// `Uint8ClampedList`.
|
||||||
abstract final class Uint8ClampedList implements List<int>, _TypedIntList {
|
abstract final class Uint8ClampedList implements _TypedIntList {
|
||||||
/// Creates a [Uint8ClampedList] of the specified length (in elements), all of
|
/// Creates a [Uint8ClampedList] of the specified length (in elements), all of
|
||||||
/// whose elements are initially zero.
|
/// whose elements are initially zero.
|
||||||
///
|
///
|
||||||
|
@ -1044,7 +1057,7 @@ abstract final class Uint8ClampedList implements List<int>, _TypedIntList {
|
||||||
@Since("3.3")
|
@Since("3.3")
|
||||||
Uint8ClampedList asUnmodifiableView();
|
Uint8ClampedList asUnmodifiableView();
|
||||||
|
|
||||||
/// Returns a new list containing the elements between [start] and [end].
|
/// Creates a new list containing the elements between [start] and [end].
|
||||||
///
|
///
|
||||||
/// The new list is a `Uint8ClampedList` containing the elements of this
|
/// The new list is a `Uint8ClampedList` containing the elements of this
|
||||||
/// list at positions greater than or equal to [start] and less than [end] in
|
/// list at positions greater than or equal to [start] and less than [end] in
|
||||||
|
@ -1063,7 +1076,7 @@ abstract final class Uint8ClampedList implements List<int>, _TypedIntList {
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// The `start` and `end` positions must satisfy the relations
|
/// The `start` and `end` positions must satisfy the relations
|
||||||
/// 0 ≤ `start` ≤ `end` ≤ `this.length`
|
/// 0 ≤ `start` ≤ `end` ≤ `this.length`.
|
||||||
/// If `end` is equal to `start`, then the returned list is empty.
|
/// If `end` is equal to `start`, then the returned list is empty.
|
||||||
Uint8ClampedList sublist(int start, [int? end]);
|
Uint8ClampedList sublist(int start, [int? end]);
|
||||||
|
|
||||||
|
@ -1081,8 +1094,8 @@ abstract final class Uint8ClampedList implements List<int>, _TypedIntList {
|
||||||
/// range -32768 to +32767.
|
/// range -32768 to +32767.
|
||||||
///
|
///
|
||||||
/// It is a compile-time error for a class to attempt to extend or implement
|
/// It is a compile-time error for a class to attempt to extend or implement
|
||||||
/// Int16List.
|
/// `Int16List`.
|
||||||
abstract final class Int16List implements List<int>, _TypedIntList {
|
abstract final class Int16List implements _TypedIntList {
|
||||||
/// Creates an [Int16List] of the specified length (in elements), all of
|
/// Creates an [Int16List] of the specified length (in elements), all of
|
||||||
/// whose elements are initially zero.
|
/// whose elements are initially zero.
|
||||||
///
|
///
|
||||||
|
@ -1173,7 +1186,7 @@ abstract final class Int16List implements List<int>, _TypedIntList {
|
||||||
@Since("3.3")
|
@Since("3.3")
|
||||||
Int16List asUnmodifiableView();
|
Int16List asUnmodifiableView();
|
||||||
|
|
||||||
/// Returns a new list containing the elements between [start] and [end].
|
/// Creates a new list containing the elements between [start] and [end].
|
||||||
///
|
///
|
||||||
/// The new list is an `Int16List` containing the elements of this
|
/// The new list is an `Int16List` containing the elements of this
|
||||||
/// list at positions greater than or equal to [start] and less than [end] in
|
/// list at positions greater than or equal to [start] and less than [end] in
|
||||||
|
@ -1192,7 +1205,7 @@ abstract final class Int16List implements List<int>, _TypedIntList {
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// The `start` and `end` positions must satisfy the relations
|
/// The `start` and `end` positions must satisfy the relations
|
||||||
/// 0 ≤ `start` ≤ `end` ≤ `this.length`
|
/// 0 ≤ `start` ≤ `end` ≤ `this.length`.
|
||||||
/// If `end` is equal to `start`, then the returned list is empty.
|
/// If `end` is equal to `start`, then the returned list is empty.
|
||||||
Int16List sublist(int start, [int? end]);
|
Int16List sublist(int start, [int? end]);
|
||||||
|
|
||||||
|
@ -1210,8 +1223,8 @@ abstract final class Int16List implements List<int>, _TypedIntList {
|
||||||
/// range 0 to 65535.
|
/// range 0 to 65535.
|
||||||
///
|
///
|
||||||
/// It is a compile-time error for a class to attempt to extend or implement
|
/// It is a compile-time error for a class to attempt to extend or implement
|
||||||
/// Uint16List.
|
/// `Uint16List`.
|
||||||
abstract final class Uint16List implements List<int>, _TypedIntList {
|
abstract final class Uint16List implements _TypedIntList {
|
||||||
/// Creates a [Uint16List] of the specified length (in elements), all
|
/// Creates a [Uint16List] of the specified length (in elements), all
|
||||||
/// of whose elements are initially zero.
|
/// of whose elements are initially zero.
|
||||||
///
|
///
|
||||||
|
@ -1303,7 +1316,7 @@ abstract final class Uint16List implements List<int>, _TypedIntList {
|
||||||
@Since("3.3")
|
@Since("3.3")
|
||||||
Uint16List asUnmodifiableView();
|
Uint16List asUnmodifiableView();
|
||||||
|
|
||||||
/// Returns a new list containing the elements between [start] and [end].
|
/// Creates a new list containing the elements between [start] and [end].
|
||||||
///
|
///
|
||||||
/// The new list is a `Uint16List` containing the elements of this
|
/// The new list is a `Uint16List` containing the elements of this
|
||||||
/// list at positions greater than or equal to [start] and less than [end] in
|
/// list at positions greater than or equal to [start] and less than [end] in
|
||||||
|
@ -1322,7 +1335,7 @@ abstract final class Uint16List implements List<int>, _TypedIntList {
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// The `start` and `end` positions must satisfy the relations
|
/// The `start` and `end` positions must satisfy the relations
|
||||||
/// 0 ≤ `start` ≤ `end` ≤ `this.length`
|
/// 0 ≤ `start` ≤ `end` ≤ `this.length`.
|
||||||
/// If `end` is equal to `start`, then the returned list is empty.
|
/// If `end` is equal to `start`, then the returned list is empty.
|
||||||
Uint16List sublist(int start, [int? end]);
|
Uint16List sublist(int start, [int? end]);
|
||||||
|
|
||||||
|
@ -1340,8 +1353,8 @@ abstract final class Uint16List implements List<int>, _TypedIntList {
|
||||||
/// range -2147483648 to 2147483647.
|
/// range -2147483648 to 2147483647.
|
||||||
///
|
///
|
||||||
/// It is a compile-time error for a class to attempt to extend or implement
|
/// It is a compile-time error for a class to attempt to extend or implement
|
||||||
/// Int32List.
|
/// `Int32List`.
|
||||||
abstract final class Int32List implements List<int>, _TypedIntList {
|
abstract final class Int32List implements _TypedIntList {
|
||||||
/// Creates an [Int32List] of the specified length (in elements), all of
|
/// Creates an [Int32List] of the specified length (in elements), all of
|
||||||
/// whose elements are initially zero.
|
/// whose elements are initially zero.
|
||||||
///
|
///
|
||||||
|
@ -1432,7 +1445,7 @@ abstract final class Int32List implements List<int>, _TypedIntList {
|
||||||
@Since("3.3")
|
@Since("3.3")
|
||||||
Int32List asUnmodifiableView();
|
Int32List asUnmodifiableView();
|
||||||
|
|
||||||
/// Returns a new list containing the elements between [start] and [end].
|
/// Creates a new list containing the elements between [start] and [end].
|
||||||
///
|
///
|
||||||
/// The new list is an `Int32List` containing the elements of this
|
/// The new list is an `Int32List` containing the elements of this
|
||||||
/// list at positions greater than or equal to [start] and less than [end] in
|
/// list at positions greater than or equal to [start] and less than [end] in
|
||||||
|
@ -1451,7 +1464,7 @@ abstract final class Int32List implements List<int>, _TypedIntList {
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// The `start` and `end` positions must satisfy the relations
|
/// The `start` and `end` positions must satisfy the relations
|
||||||
/// 0 ≤ `start` ≤ `end` ≤ `this.length`
|
/// 0 ≤ `start` ≤ `end` ≤ `this.length`.
|
||||||
/// If `end` is equal to `start`, then the returned list is empty.
|
/// If `end` is equal to `start`, then the returned list is empty.
|
||||||
Int32List sublist(int start, [int? end]);
|
Int32List sublist(int start, [int? end]);
|
||||||
|
|
||||||
|
@ -1469,8 +1482,8 @@ abstract final class Int32List implements List<int>, _TypedIntList {
|
||||||
/// range 0 to 4294967295.
|
/// range 0 to 4294967295.
|
||||||
///
|
///
|
||||||
/// It is a compile-time error for a class to attempt to extend or implement
|
/// It is a compile-time error for a class to attempt to extend or implement
|
||||||
/// Uint32List.
|
/// `Uint32List`.
|
||||||
abstract final class Uint32List implements List<int>, _TypedIntList {
|
abstract final class Uint32List implements _TypedIntList {
|
||||||
/// Creates a [Uint32List] of the specified length (in elements), all
|
/// Creates a [Uint32List] of the specified length (in elements), all
|
||||||
/// of whose elements are initially zero.
|
/// of whose elements are initially zero.
|
||||||
///
|
///
|
||||||
|
@ -1562,7 +1575,7 @@ abstract final class Uint32List implements List<int>, _TypedIntList {
|
||||||
@Since("3.3")
|
@Since("3.3")
|
||||||
Uint32List asUnmodifiableView();
|
Uint32List asUnmodifiableView();
|
||||||
|
|
||||||
/// Returns a new list containing the elements between [start] and [end].
|
/// Creates a new list containing the elements between [start] and [end].
|
||||||
///
|
///
|
||||||
/// The new list is a `Uint32List` containing the elements of this
|
/// The new list is a `Uint32List` containing the elements of this
|
||||||
/// list at positions greater than or equal to [start] and less than [end] in
|
/// list at positions greater than or equal to [start] and less than [end] in
|
||||||
|
@ -1581,7 +1594,7 @@ abstract final class Uint32List implements List<int>, _TypedIntList {
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// The `start` and `end` positions must satisfy the relations
|
/// The `start` and `end` positions must satisfy the relations
|
||||||
/// 0 ≤ `start` ≤ `end` ≤ `this.length`
|
/// 0 ≤ `start` ≤ `end` ≤ `this.length`.
|
||||||
/// If `end` is equal to `start`, then the returned list is empty.
|
/// If `end` is equal to `start`, then the returned list is empty.
|
||||||
Uint32List sublist(int start, [int? end]);
|
Uint32List sublist(int start, [int? end]);
|
||||||
|
|
||||||
|
@ -1599,8 +1612,8 @@ abstract final class Uint32List implements List<int>, _TypedIntList {
|
||||||
/// range -9223372036854775808 to +9223372036854775807.
|
/// range -9223372036854775808 to +9223372036854775807.
|
||||||
///
|
///
|
||||||
/// It is a compile-time error for a class to attempt to extend or implement
|
/// It is a compile-time error for a class to attempt to extend or implement
|
||||||
/// Int64List.
|
/// `Int64List`.
|
||||||
abstract final class Int64List implements List<int>, _TypedIntList {
|
abstract final class Int64List implements _TypedIntList {
|
||||||
/// Creates an [Int64List] of the specified length (in elements), all of
|
/// Creates an [Int64List] of the specified length (in elements), all of
|
||||||
/// whose elements are initially zero.
|
/// whose elements are initially zero.
|
||||||
///
|
///
|
||||||
|
@ -1691,7 +1704,7 @@ abstract final class Int64List implements List<int>, _TypedIntList {
|
||||||
@Since("3.3")
|
@Since("3.3")
|
||||||
Int64List asUnmodifiableView();
|
Int64List asUnmodifiableView();
|
||||||
|
|
||||||
/// Returns a new list containing the elements between [start] and [end].
|
/// Creates a new list containing the elements between [start] and [end].
|
||||||
///
|
///
|
||||||
/// The new list is an `Int64List` containing the elements of this
|
/// The new list is an `Int64List` containing the elements of this
|
||||||
/// list at positions greater than or equal to [start] and less than [end] in
|
/// list at positions greater than or equal to [start] and less than [end] in
|
||||||
|
@ -1710,7 +1723,7 @@ abstract final class Int64List implements List<int>, _TypedIntList {
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// The `start` and `end` positions must satisfy the relations
|
/// The `start` and `end` positions must satisfy the relations
|
||||||
/// 0 ≤ `start` ≤ `end` ≤ `this.length`
|
/// 0 ≤ `start` ≤ `end` ≤ `this.length`.
|
||||||
/// If `end` is equal to `start`, then the returned list is empty.
|
/// If `end` is equal to `start`, then the returned list is empty.
|
||||||
Int64List sublist(int start, [int? end]);
|
Int64List sublist(int start, [int? end]);
|
||||||
|
|
||||||
|
@ -1728,8 +1741,8 @@ abstract final class Int64List implements List<int>, _TypedIntList {
|
||||||
/// range 0 to 18446744073709551615.
|
/// range 0 to 18446744073709551615.
|
||||||
///
|
///
|
||||||
/// It is a compile-time error for a class to attempt to extend or implement
|
/// It is a compile-time error for a class to attempt to extend or implement
|
||||||
/// Uint64List.
|
/// `Uint64List`.
|
||||||
abstract final class Uint64List implements List<int>, _TypedIntList {
|
abstract final class Uint64List implements _TypedIntList {
|
||||||
/// Creates a [Uint64List] of the specified length (in elements), all
|
/// Creates a [Uint64List] of the specified length (in elements), all
|
||||||
/// of whose elements are initially zero.
|
/// of whose elements are initially zero.
|
||||||
///
|
///
|
||||||
|
@ -1821,7 +1834,7 @@ abstract final class Uint64List implements List<int>, _TypedIntList {
|
||||||
@Since("3.3")
|
@Since("3.3")
|
||||||
Uint64List asUnmodifiableView();
|
Uint64List asUnmodifiableView();
|
||||||
|
|
||||||
/// Returns a new list containing the elements between [start] and [end].
|
/// Creates a new list containing the elements between [start] and [end].
|
||||||
///
|
///
|
||||||
/// The new list is a `Uint64List` containing the elements of this
|
/// The new list is a `Uint64List` containing the elements of this
|
||||||
/// list at positions greater than or equal to [start] and less than [end] in
|
/// list at positions greater than or equal to [start] and less than [end] in
|
||||||
|
@ -1840,7 +1853,7 @@ abstract final class Uint64List implements List<int>, _TypedIntList {
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// The `start` and `end` positions must satisfy the relations
|
/// The `start` and `end` positions must satisfy the relations
|
||||||
/// 0 ≤ `start` ≤ `end` ≤ `this.length`
|
/// 0 ≤ `start` ≤ `end` ≤ `this.length`.
|
||||||
/// If `end` is equal to `start`, then the returned list is empty.
|
/// If `end` is equal to `start`, then the returned list is empty.
|
||||||
Uint64List sublist(int start, [int? end]);
|
Uint64List sublist(int start, [int? end]);
|
||||||
|
|
||||||
|
@ -1859,8 +1872,8 @@ abstract final class Uint64List implements List<int>, _TypedIntList {
|
||||||
/// value with the same value.
|
/// value with the same value.
|
||||||
///
|
///
|
||||||
/// It is a compile-time error for a class to attempt to extend or implement
|
/// It is a compile-time error for a class to attempt to extend or implement
|
||||||
/// Float32List.
|
/// `Float32List`.
|
||||||
abstract final class Float32List implements List<double>, _TypedFloatList {
|
abstract final class Float32List implements _TypedFloatList {
|
||||||
/// Creates a [Float32List] of the specified length (in elements), all of
|
/// Creates a [Float32List] of the specified length (in elements), all of
|
||||||
/// whose elements are initially zero.
|
/// whose elements are initially zero.
|
||||||
///
|
///
|
||||||
|
@ -1951,7 +1964,7 @@ abstract final class Float32List implements List<double>, _TypedFloatList {
|
||||||
@Since("3.3")
|
@Since("3.3")
|
||||||
Float32List asUnmodifiableView();
|
Float32List asUnmodifiableView();
|
||||||
|
|
||||||
/// Returns a new list containing the elements between [start] and [end].
|
/// Creates a new list containing the elements between [start] and [end].
|
||||||
///
|
///
|
||||||
/// The new list is a `Float32List` containing the elements of this
|
/// The new list is a `Float32List` containing the elements of this
|
||||||
/// list at positions greater than or equal to [start] and less than [end] in
|
/// list at positions greater than or equal to [start] and less than [end] in
|
||||||
|
@ -1970,7 +1983,7 @@ abstract final class Float32List implements List<double>, _TypedFloatList {
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// The `start` and `end` positions must satisfy the relations
|
/// The `start` and `end` positions must satisfy the relations
|
||||||
/// 0 ≤ `start` ≤ `end` ≤ `this.length`
|
/// 0 ≤ `start` ≤ `end` ≤ `this.length`.
|
||||||
/// If `end` is equal to `start`, then the returned list is empty.
|
/// If `end` is equal to `start`, then the returned list is empty.
|
||||||
Float32List sublist(int start, [int? end]);
|
Float32List sublist(int start, [int? end]);
|
||||||
|
|
||||||
|
@ -1985,8 +1998,8 @@ abstract final class Float32List implements List<double>, _TypedFloatList {
|
||||||
/// the default [List] implementation.
|
/// the default [List] implementation.
|
||||||
///
|
///
|
||||||
/// It is a compile-time error for a class to attempt to extend or implement
|
/// It is a compile-time error for a class to attempt to extend or implement
|
||||||
/// Float64List.
|
/// `Float64List`.
|
||||||
abstract final class Float64List implements List<double>, _TypedFloatList {
|
abstract final class Float64List implements _TypedFloatList {
|
||||||
/// Creates a [Float64List] of the specified length (in elements), all of
|
/// Creates a [Float64List] of the specified length (in elements), all of
|
||||||
/// whose elements are initially zero.
|
/// whose elements are initially zero.
|
||||||
///
|
///
|
||||||
|
@ -2074,7 +2087,7 @@ abstract final class Float64List implements List<double>, _TypedFloatList {
|
||||||
@Since("3.3")
|
@Since("3.3")
|
||||||
Float64List asUnmodifiableView();
|
Float64List asUnmodifiableView();
|
||||||
|
|
||||||
/// Returns a new list containing the elements between [start] and [end].
|
/// Creates a new list containing the elements between [start] and [end].
|
||||||
///
|
///
|
||||||
/// The new list is a `Float64List` containing the elements of this
|
/// The new list is a `Float64List` containing the elements of this
|
||||||
/// list at positions greater than or equal to [start] and less than [end] in
|
/// list at positions greater than or equal to [start] and less than [end] in
|
||||||
|
@ -2093,22 +2106,23 @@ abstract final class Float64List implements List<double>, _TypedFloatList {
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// The `start` and `end` positions must satisfy the relations
|
/// The `start` and `end` positions must satisfy the relations
|
||||||
/// 0 ≤ `start` ≤ `end` ≤ `this.length`
|
/// 0 ≤ `start` ≤ `end` ≤ `this.length`.
|
||||||
/// If `end` is equal to `start`, then the returned list is empty.
|
/// If `end` is equal to `start`, then the returned list is empty.
|
||||||
Float64List sublist(int start, [int? end]);
|
Float64List sublist(int start, [int? end]);
|
||||||
|
|
||||||
static const int bytesPerElement = 8;
|
static const int bytesPerElement = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A fixed-length list of Float32x4 numbers that is viewable as a
|
/// A fixed-length list of [Float32x4] numbers that is viewable as a
|
||||||
/// [TypedData].
|
/// [TypedData].
|
||||||
///
|
///
|
||||||
/// For long lists, this implementation will be considerably more
|
/// For long lists, this implementation will be considerably more
|
||||||
/// space- and time-efficient than the default [List] implementation.
|
/// space- and time-efficient than the default [List] implementation.
|
||||||
///
|
///
|
||||||
/// It is a compile-time error for a class to attempt to extend or implement
|
/// It is a compile-time error for a class to attempt to extend or implement
|
||||||
/// Float32x4List.
|
/// `Float32x4List`.
|
||||||
abstract final class Float32x4List implements List<Float32x4>, TypedData {
|
abstract final class Float32x4List
|
||||||
|
implements TypedDataList<Float32x4>, TypedData {
|
||||||
/// Creates a [Float32x4List] of the specified length (in elements),
|
/// Creates a [Float32x4List] of the specified length (in elements),
|
||||||
/// all of whose elements are initially zero.
|
/// all of whose elements are initially zero.
|
||||||
///
|
///
|
||||||
|
@ -2196,13 +2210,13 @@ abstract final class Float32x4List implements List<Float32x4>, TypedData {
|
||||||
@Since("3.3")
|
@Since("3.3")
|
||||||
Float32x4List asUnmodifiableView();
|
Float32x4List asUnmodifiableView();
|
||||||
|
|
||||||
/// Returns the concatenation of this list and [other].
|
/// The concatenation of this list and [other].
|
||||||
///
|
///
|
||||||
/// If [other] is also a [Float32x4List], the result is a new [Float32x4List],
|
/// If [other] is also a [Float32x4List], the result is a new [Float32x4List],
|
||||||
/// otherwise the result is a normal growable `List<Float32x4>`.
|
/// otherwise the result is a normal growable `List<Float32x4>`.
|
||||||
List<Float32x4> operator +(List<Float32x4> other);
|
List<Float32x4> operator +(List<Float32x4> other);
|
||||||
|
|
||||||
/// Returns a new list containing the elements between [start] and [end].
|
/// Creates a new list containing the elements between [start] and [end].
|
||||||
///
|
///
|
||||||
/// The new list is a `Float32x4List` containing the elements of this
|
/// The new list is a `Float32x4List` containing the elements of this
|
||||||
/// list at positions greater than or equal to [start] and less than [end] in
|
/// list at positions greater than or equal to [start] and less than [end] in
|
||||||
|
@ -2227,19 +2241,19 @@ abstract final class Float32x4List implements List<Float32x4>, TypedData {
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// The `start` and `end` positions must satisfy the relations
|
/// The `start` and `end` positions must satisfy the relations
|
||||||
/// 0 ≤ `start` ≤ `end` ≤ `this.length`
|
/// 0 ≤ `start` ≤ `end` ≤ `this.length`.
|
||||||
/// If `end` is equal to `start`, then the returned list is empty.
|
/// If `end` is equal to `start`, then the returned list is empty.
|
||||||
Float32x4List sublist(int start, [int? end]);
|
Float32x4List sublist(int start, [int? end]);
|
||||||
|
|
||||||
static const int bytesPerElement = 16;
|
static const int bytesPerElement = 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A fixed-length list of Int32x4 numbers that is viewable as a
|
/// A fixed-length list of [Int32x4] numbers that is viewable as a
|
||||||
/// [TypedData].
|
/// [TypedData].
|
||||||
///
|
///
|
||||||
/// For long lists, this implementation will be considerably more
|
/// For long lists, this implementation will be considerably more
|
||||||
/// space- and time-efficient than the default [List] implementation.
|
/// space- and time-efficient than the default [List] implementation.
|
||||||
abstract final class Int32x4List implements List<Int32x4>, TypedData {
|
abstract final class Int32x4List implements TypedDataList<Int32x4>, TypedData {
|
||||||
/// Creates a [Int32x4List] of the specified length (in elements),
|
/// Creates a [Int32x4List] of the specified length (in elements),
|
||||||
/// all of whose elements are initially zero.
|
/// all of whose elements are initially zero.
|
||||||
///
|
///
|
||||||
|
@ -2327,13 +2341,13 @@ abstract final class Int32x4List implements List<Int32x4>, TypedData {
|
||||||
@Since("3.3")
|
@Since("3.3")
|
||||||
Int32x4List asUnmodifiableView();
|
Int32x4List asUnmodifiableView();
|
||||||
|
|
||||||
/// Returns the concatenation of this list and [other].
|
/// The concatenation of this list and [other].
|
||||||
///
|
///
|
||||||
/// If [other] is also a [Int32x4List], the result is a new [Int32x4List],
|
/// If [other] is also a [Int32x4List], the result is a new [Int32x4List],
|
||||||
/// otherwise the result is a normal growable `List<Int32x4>`.
|
/// otherwise the result is a normal growable `List<Int32x4>`.
|
||||||
List<Int32x4> operator +(List<Int32x4> other);
|
List<Int32x4> operator +(List<Int32x4> other);
|
||||||
|
|
||||||
/// Returns a new list containing the elements between [start] and [end].
|
/// Creates a new list containing the elements between [start] and [end].
|
||||||
///
|
///
|
||||||
/// The new list is an `Int32x4List` containing the elements of this
|
/// The new list is an `Int32x4List` containing the elements of this
|
||||||
/// list at positions greater than or equal to [start] and less than [end] in
|
/// list at positions greater than or equal to [start] and less than [end] in
|
||||||
|
@ -2358,22 +2372,23 @@ abstract final class Int32x4List implements List<Int32x4>, TypedData {
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// The `start` and `end` positions must satisfy the relations
|
/// The `start` and `end` positions must satisfy the relations
|
||||||
/// 0 ≤ `start` ≤ `end` ≤ `this.length`
|
/// 0 ≤ `start` ≤ `end` ≤ `this.length`.
|
||||||
/// If `end` is equal to `start`, then the returned list is empty.
|
/// If `end` is equal to `start`, then the returned list is empty.
|
||||||
Int32x4List sublist(int start, [int? end]);
|
Int32x4List sublist(int start, [int? end]);
|
||||||
|
|
||||||
static const int bytesPerElement = 16;
|
static const int bytesPerElement = 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A fixed-length list of Float64x2 numbers that is viewable as a
|
/// A fixed-length list of [Float64x2] numbers that is viewable as a
|
||||||
/// [TypedData].
|
/// [TypedData].
|
||||||
///
|
///
|
||||||
/// For long lists, this implementation will be considerably more
|
/// For long lists, this implementation will be considerably more
|
||||||
/// space- and time-efficient than the default [List] implementation.
|
/// space- and time-efficient than the default [List] implementation.
|
||||||
///
|
///
|
||||||
/// It is a compile-time error for a class to attempt to extend or implement
|
/// It is a compile-time error for a class to attempt to extend or implement
|
||||||
/// Float64x2List.
|
/// `Float64x2List`.
|
||||||
abstract final class Float64x2List implements List<Float64x2>, TypedData {
|
abstract final class Float64x2List
|
||||||
|
implements TypedDataList<Float64x2>, TypedData {
|
||||||
/// Creates a [Float64x2List] of the specified length (in elements),
|
/// Creates a [Float64x2List] of the specified length (in elements),
|
||||||
/// all of whose elements have all lanes set to zero.
|
/// all of whose elements have all lanes set to zero.
|
||||||
///
|
///
|
||||||
|
@ -2388,7 +2403,7 @@ abstract final class Float64x2List implements List<Float64x2>, TypedData {
|
||||||
/// `elements.length` times 16 bytes.
|
/// `elements.length` times 16 bytes.
|
||||||
external factory Float64x2List.fromList(List<Float64x2> elements);
|
external factory Float64x2List.fromList(List<Float64x2> elements);
|
||||||
|
|
||||||
/// Returns the concatenation of this list and [other].
|
/// The concatenation of this list and [other].
|
||||||
///
|
///
|
||||||
/// If [other] is also a [Float64x2List], the result is a new [Float64x2List],
|
/// If [other] is also a [Float64x2List], the result is a new [Float64x2List],
|
||||||
/// otherwise the result is a normal growable `List<Float64x2>`.
|
/// otherwise the result is a normal growable `List<Float64x2>`.
|
||||||
|
@ -2467,7 +2482,7 @@ abstract final class Float64x2List implements List<Float64x2>, TypedData {
|
||||||
@Since("3.3")
|
@Since("3.3")
|
||||||
Float64x2List asUnmodifiableView();
|
Float64x2List asUnmodifiableView();
|
||||||
|
|
||||||
/// Returns a new list containing the elements between [start] and [end].
|
/// Creates a new list containing the elements between [start] and [end].
|
||||||
///
|
///
|
||||||
/// The new list is a `Float64x2List` containing the elements of this
|
/// The new list is a `Float64x2List` containing the elements of this
|
||||||
/// list at positions greater than or equal to [start] and less than [end] in
|
/// list at positions greater than or equal to [start] and less than [end] in
|
||||||
|
@ -2492,7 +2507,7 @@ abstract final class Float64x2List implements List<Float64x2>, TypedData {
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// The `start` and `end` positions must satisfy the relations
|
/// The `start` and `end` positions must satisfy the relations
|
||||||
/// 0 ≤ `start` ≤ `end` ≤ `this.length`
|
/// 0 ≤ `start` ≤ `end` ≤ `this.length`.
|
||||||
/// If `end` is equal to `start`, then the returned list is empty.
|
/// If `end` is equal to `start`, then the returned list is empty.
|
||||||
Float64x2List sublist(int start, [int? end]);
|
Float64x2List sublist(int start, [int? end]);
|
||||||
|
|
||||||
|
@ -2505,7 +2520,7 @@ abstract final class Float64x2List implements List<Float64x2>, TypedData {
|
||||||
/// The lanes are "x", "y", "z", and "w" respectively.
|
/// The lanes are "x", "y", "z", and "w" respectively.
|
||||||
///
|
///
|
||||||
/// It is a compile-time error for a class to attempt to extend or implement
|
/// It is a compile-time error for a class to attempt to extend or implement
|
||||||
/// Float32x4.
|
/// `Float32x4`.
|
||||||
abstract final class Float32x4 {
|
abstract final class Float32x4 {
|
||||||
external factory Float32x4(double x, double y, double z, double w);
|
external factory Float32x4(double x, double y, double z, double w);
|
||||||
external factory Float32x4.splat(double v);
|
external factory Float32x4.splat(double v);
|
||||||
|
@ -2553,7 +2568,7 @@ abstract final class Float32x4 {
|
||||||
/// Equivalent to this * new Float32x4.splat(s)
|
/// Equivalent to this * new Float32x4.splat(s)
|
||||||
Float32x4 scale(double s);
|
Float32x4 scale(double s);
|
||||||
|
|
||||||
/// Returns the lane-wise absolute value of this [Float32x4].
|
/// The lane-wise absolute value of this [Float32x4].
|
||||||
Float32x4 abs();
|
Float32x4 abs();
|
||||||
|
|
||||||
/// Lane-wise clamp this [Float32x4] to be in the range
|
/// Lane-wise clamp this [Float32x4] to be in the range
|
||||||
|
@ -2580,7 +2595,7 @@ abstract final class Float32x4 {
|
||||||
int get signMask;
|
int get signMask;
|
||||||
|
|
||||||
/// Mask passed to [shuffle] or [shuffleMix].
|
/// Mask passed to [shuffle] or [shuffleMix].
|
||||||
static const int xxxx = 0x0;
|
static const int xxxx = 0x00;
|
||||||
static const int xxxy = 0x40;
|
static const int xxxy = 0x40;
|
||||||
static const int xxxz = 0x80;
|
static const int xxxz = 0x80;
|
||||||
static const int xxxw = 0xC0;
|
static const int xxxw = 0xC0;
|
||||||
|
@ -2596,7 +2611,7 @@ abstract final class Float32x4 {
|
||||||
static const int xxwy = 0x70;
|
static const int xxwy = 0x70;
|
||||||
static const int xxwz = 0xB0;
|
static const int xxwz = 0xB0;
|
||||||
static const int xxww = 0xF0;
|
static const int xxww = 0xF0;
|
||||||
static const int xyxx = 0x4;
|
static const int xyxx = 0x04;
|
||||||
static const int xyxy = 0x44;
|
static const int xyxy = 0x44;
|
||||||
static const int xyxz = 0x84;
|
static const int xyxz = 0x84;
|
||||||
static const int xyxw = 0xC4;
|
static const int xyxw = 0xC4;
|
||||||
|
@ -2612,7 +2627,7 @@ abstract final class Float32x4 {
|
||||||
static const int xywy = 0x74;
|
static const int xywy = 0x74;
|
||||||
static const int xywz = 0xB4;
|
static const int xywz = 0xB4;
|
||||||
static const int xyww = 0xF4;
|
static const int xyww = 0xF4;
|
||||||
static const int xzxx = 0x8;
|
static const int xzxx = 0x08;
|
||||||
static const int xzxy = 0x48;
|
static const int xzxy = 0x48;
|
||||||
static const int xzxz = 0x88;
|
static const int xzxz = 0x88;
|
||||||
static const int xzxw = 0xC8;
|
static const int xzxw = 0xC8;
|
||||||
|
@ -2628,7 +2643,7 @@ abstract final class Float32x4 {
|
||||||
static const int xzwy = 0x78;
|
static const int xzwy = 0x78;
|
||||||
static const int xzwz = 0xB8;
|
static const int xzwz = 0xB8;
|
||||||
static const int xzww = 0xF8;
|
static const int xzww = 0xF8;
|
||||||
static const int xwxx = 0xC;
|
static const int xwxx = 0x0C;
|
||||||
static const int xwxy = 0x4C;
|
static const int xwxy = 0x4C;
|
||||||
static const int xwxz = 0x8C;
|
static const int xwxz = 0x8C;
|
||||||
static const int xwxw = 0xCC;
|
static const int xwxw = 0xCC;
|
||||||
|
@ -2644,7 +2659,7 @@ abstract final class Float32x4 {
|
||||||
static const int xwwy = 0x7C;
|
static const int xwwy = 0x7C;
|
||||||
static const int xwwz = 0xBC;
|
static const int xwwz = 0xBC;
|
||||||
static const int xwww = 0xFC;
|
static const int xwww = 0xFC;
|
||||||
static const int yxxx = 0x1;
|
static const int yxxx = 0x01;
|
||||||
static const int yxxy = 0x41;
|
static const int yxxy = 0x41;
|
||||||
static const int yxxz = 0x81;
|
static const int yxxz = 0x81;
|
||||||
static const int yxxw = 0xC1;
|
static const int yxxw = 0xC1;
|
||||||
|
@ -2660,7 +2675,7 @@ abstract final class Float32x4 {
|
||||||
static const int yxwy = 0x71;
|
static const int yxwy = 0x71;
|
||||||
static const int yxwz = 0xB1;
|
static const int yxwz = 0xB1;
|
||||||
static const int yxww = 0xF1;
|
static const int yxww = 0xF1;
|
||||||
static const int yyxx = 0x5;
|
static const int yyxx = 0x05;
|
||||||
static const int yyxy = 0x45;
|
static const int yyxy = 0x45;
|
||||||
static const int yyxz = 0x85;
|
static const int yyxz = 0x85;
|
||||||
static const int yyxw = 0xC5;
|
static const int yyxw = 0xC5;
|
||||||
|
@ -2676,7 +2691,7 @@ abstract final class Float32x4 {
|
||||||
static const int yywy = 0x75;
|
static const int yywy = 0x75;
|
||||||
static const int yywz = 0xB5;
|
static const int yywz = 0xB5;
|
||||||
static const int yyww = 0xF5;
|
static const int yyww = 0xF5;
|
||||||
static const int yzxx = 0x9;
|
static const int yzxx = 0x09;
|
||||||
static const int yzxy = 0x49;
|
static const int yzxy = 0x49;
|
||||||
static const int yzxz = 0x89;
|
static const int yzxz = 0x89;
|
||||||
static const int yzxw = 0xC9;
|
static const int yzxw = 0xC9;
|
||||||
|
@ -2692,7 +2707,7 @@ abstract final class Float32x4 {
|
||||||
static const int yzwy = 0x79;
|
static const int yzwy = 0x79;
|
||||||
static const int yzwz = 0xB9;
|
static const int yzwz = 0xB9;
|
||||||
static const int yzww = 0xF9;
|
static const int yzww = 0xF9;
|
||||||
static const int ywxx = 0xD;
|
static const int ywxx = 0x0D;
|
||||||
static const int ywxy = 0x4D;
|
static const int ywxy = 0x4D;
|
||||||
static const int ywxz = 0x8D;
|
static const int ywxz = 0x8D;
|
||||||
static const int ywxw = 0xCD;
|
static const int ywxw = 0xCD;
|
||||||
|
@ -2708,7 +2723,7 @@ abstract final class Float32x4 {
|
||||||
static const int ywwy = 0x7D;
|
static const int ywwy = 0x7D;
|
||||||
static const int ywwz = 0xBD;
|
static const int ywwz = 0xBD;
|
||||||
static const int ywww = 0xFD;
|
static const int ywww = 0xFD;
|
||||||
static const int zxxx = 0x2;
|
static const int zxxx = 0x02;
|
||||||
static const int zxxy = 0x42;
|
static const int zxxy = 0x42;
|
||||||
static const int zxxz = 0x82;
|
static const int zxxz = 0x82;
|
||||||
static const int zxxw = 0xC2;
|
static const int zxxw = 0xC2;
|
||||||
|
@ -2724,7 +2739,7 @@ abstract final class Float32x4 {
|
||||||
static const int zxwy = 0x72;
|
static const int zxwy = 0x72;
|
||||||
static const int zxwz = 0xB2;
|
static const int zxwz = 0xB2;
|
||||||
static const int zxww = 0xF2;
|
static const int zxww = 0xF2;
|
||||||
static const int zyxx = 0x6;
|
static const int zyxx = 0x06;
|
||||||
static const int zyxy = 0x46;
|
static const int zyxy = 0x46;
|
||||||
static const int zyxz = 0x86;
|
static const int zyxz = 0x86;
|
||||||
static const int zyxw = 0xC6;
|
static const int zyxw = 0xC6;
|
||||||
|
@ -2740,7 +2755,7 @@ abstract final class Float32x4 {
|
||||||
static const int zywy = 0x76;
|
static const int zywy = 0x76;
|
||||||
static const int zywz = 0xB6;
|
static const int zywz = 0xB6;
|
||||||
static const int zyww = 0xF6;
|
static const int zyww = 0xF6;
|
||||||
static const int zzxx = 0xA;
|
static const int zzxx = 0x0A;
|
||||||
static const int zzxy = 0x4A;
|
static const int zzxy = 0x4A;
|
||||||
static const int zzxz = 0x8A;
|
static const int zzxz = 0x8A;
|
||||||
static const int zzxw = 0xCA;
|
static const int zzxw = 0xCA;
|
||||||
|
@ -2756,7 +2771,7 @@ abstract final class Float32x4 {
|
||||||
static const int zzwy = 0x7A;
|
static const int zzwy = 0x7A;
|
||||||
static const int zzwz = 0xBA;
|
static const int zzwz = 0xBA;
|
||||||
static const int zzww = 0xFA;
|
static const int zzww = 0xFA;
|
||||||
static const int zwxx = 0xE;
|
static const int zwxx = 0x0E;
|
||||||
static const int zwxy = 0x4E;
|
static const int zwxy = 0x4E;
|
||||||
static const int zwxz = 0x8E;
|
static const int zwxz = 0x8E;
|
||||||
static const int zwxw = 0xCE;
|
static const int zwxw = 0xCE;
|
||||||
|
@ -2772,7 +2787,7 @@ abstract final class Float32x4 {
|
||||||
static const int zwwy = 0x7E;
|
static const int zwwy = 0x7E;
|
||||||
static const int zwwz = 0xBE;
|
static const int zwwz = 0xBE;
|
||||||
static const int zwww = 0xFE;
|
static const int zwww = 0xFE;
|
||||||
static const int wxxx = 0x3;
|
static const int wxxx = 0x03;
|
||||||
static const int wxxy = 0x43;
|
static const int wxxy = 0x43;
|
||||||
static const int wxxz = 0x83;
|
static const int wxxz = 0x83;
|
||||||
static const int wxxw = 0xC3;
|
static const int wxxw = 0xC3;
|
||||||
|
@ -2788,7 +2803,7 @@ abstract final class Float32x4 {
|
||||||
static const int wxwy = 0x73;
|
static const int wxwy = 0x73;
|
||||||
static const int wxwz = 0xB3;
|
static const int wxwz = 0xB3;
|
||||||
static const int wxww = 0xF3;
|
static const int wxww = 0xF3;
|
||||||
static const int wyxx = 0x7;
|
static const int wyxx = 0x07;
|
||||||
static const int wyxy = 0x47;
|
static const int wyxy = 0x47;
|
||||||
static const int wyxz = 0x87;
|
static const int wyxz = 0x87;
|
||||||
static const int wyxw = 0xC7;
|
static const int wyxw = 0xC7;
|
||||||
|
@ -2804,7 +2819,7 @@ abstract final class Float32x4 {
|
||||||
static const int wywy = 0x77;
|
static const int wywy = 0x77;
|
||||||
static const int wywz = 0xB7;
|
static const int wywz = 0xB7;
|
||||||
static const int wyww = 0xF7;
|
static const int wyww = 0xF7;
|
||||||
static const int wzxx = 0xB;
|
static const int wzxx = 0x0B;
|
||||||
static const int wzxy = 0x4B;
|
static const int wzxy = 0x4B;
|
||||||
static const int wzxz = 0x8B;
|
static const int wzxz = 0x8B;
|
||||||
static const int wzxw = 0xCB;
|
static const int wzxw = 0xCB;
|
||||||
|
@ -2820,7 +2835,7 @@ abstract final class Float32x4 {
|
||||||
static const int wzwy = 0x7B;
|
static const int wzwy = 0x7B;
|
||||||
static const int wzwz = 0xBB;
|
static const int wzwz = 0xBB;
|
||||||
static const int wzww = 0xFB;
|
static const int wzww = 0xFB;
|
||||||
static const int wwxx = 0xF;
|
static const int wwxx = 0x0F;
|
||||||
static const int wwxy = 0x4F;
|
static const int wwxy = 0x4F;
|
||||||
static const int wwxz = 0x8F;
|
static const int wwxz = 0x8F;
|
||||||
static const int wwxw = 0xCF;
|
static const int wwxw = 0xCF;
|
||||||
|
@ -2861,19 +2876,19 @@ abstract final class Float32x4 {
|
||||||
/// value.
|
/// value.
|
||||||
Float32x4 withW(double w);
|
Float32x4 withW(double w);
|
||||||
|
|
||||||
/// Returns the lane-wise minimum value in this [Float32x4] or [other].
|
/// The lane-wise minimum value in this [Float32x4] or [other].
|
||||||
Float32x4 min(Float32x4 other);
|
Float32x4 min(Float32x4 other);
|
||||||
|
|
||||||
/// Returns the lane-wise maximum value in this [Float32x4] or [other].
|
/// The lane-wise maximum value in this [Float32x4] or [other].
|
||||||
Float32x4 max(Float32x4 other);
|
Float32x4 max(Float32x4 other);
|
||||||
|
|
||||||
/// Returns the square root of this [Float32x4].
|
/// The square root of this [Float32x4].
|
||||||
Float32x4 sqrt();
|
Float32x4 sqrt();
|
||||||
|
|
||||||
/// Returns the reciprocal of this [Float32x4].
|
/// The reciprocal of this [Float32x4].
|
||||||
Float32x4 reciprocal();
|
Float32x4 reciprocal();
|
||||||
|
|
||||||
/// Returns the square root of the reciprocal of this [Float32x4].
|
/// The square root of the reciprocal of this [Float32x4].
|
||||||
Float32x4 reciprocalSqrt();
|
Float32x4 reciprocalSqrt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2921,7 +2936,7 @@ abstract final class Int32x4 {
|
||||||
int get signMask;
|
int get signMask;
|
||||||
|
|
||||||
/// Mask passed to [shuffle] or [shuffleMix].
|
/// Mask passed to [shuffle] or [shuffleMix].
|
||||||
static const int xxxx = 0x0;
|
static const int xxxx = 0x00;
|
||||||
static const int xxxy = 0x40;
|
static const int xxxy = 0x40;
|
||||||
static const int xxxz = 0x80;
|
static const int xxxz = 0x80;
|
||||||
static const int xxxw = 0xC0;
|
static const int xxxw = 0xC0;
|
||||||
|
@ -2937,7 +2952,7 @@ abstract final class Int32x4 {
|
||||||
static const int xxwy = 0x70;
|
static const int xxwy = 0x70;
|
||||||
static const int xxwz = 0xB0;
|
static const int xxwz = 0xB0;
|
||||||
static const int xxww = 0xF0;
|
static const int xxww = 0xF0;
|
||||||
static const int xyxx = 0x4;
|
static const int xyxx = 0x04;
|
||||||
static const int xyxy = 0x44;
|
static const int xyxy = 0x44;
|
||||||
static const int xyxz = 0x84;
|
static const int xyxz = 0x84;
|
||||||
static const int xyxw = 0xC4;
|
static const int xyxw = 0xC4;
|
||||||
|
@ -2953,7 +2968,7 @@ abstract final class Int32x4 {
|
||||||
static const int xywy = 0x74;
|
static const int xywy = 0x74;
|
||||||
static const int xywz = 0xB4;
|
static const int xywz = 0xB4;
|
||||||
static const int xyww = 0xF4;
|
static const int xyww = 0xF4;
|
||||||
static const int xzxx = 0x8;
|
static const int xzxx = 0x08;
|
||||||
static const int xzxy = 0x48;
|
static const int xzxy = 0x48;
|
||||||
static const int xzxz = 0x88;
|
static const int xzxz = 0x88;
|
||||||
static const int xzxw = 0xC8;
|
static const int xzxw = 0xC8;
|
||||||
|
@ -2969,7 +2984,7 @@ abstract final class Int32x4 {
|
||||||
static const int xzwy = 0x78;
|
static const int xzwy = 0x78;
|
||||||
static const int xzwz = 0xB8;
|
static const int xzwz = 0xB8;
|
||||||
static const int xzww = 0xF8;
|
static const int xzww = 0xF8;
|
||||||
static const int xwxx = 0xC;
|
static const int xwxx = 0x0C;
|
||||||
static const int xwxy = 0x4C;
|
static const int xwxy = 0x4C;
|
||||||
static const int xwxz = 0x8C;
|
static const int xwxz = 0x8C;
|
||||||
static const int xwxw = 0xCC;
|
static const int xwxw = 0xCC;
|
||||||
|
@ -2985,7 +3000,7 @@ abstract final class Int32x4 {
|
||||||
static const int xwwy = 0x7C;
|
static const int xwwy = 0x7C;
|
||||||
static const int xwwz = 0xBC;
|
static const int xwwz = 0xBC;
|
||||||
static const int xwww = 0xFC;
|
static const int xwww = 0xFC;
|
||||||
static const int yxxx = 0x1;
|
static const int yxxx = 0x01;
|
||||||
static const int yxxy = 0x41;
|
static const int yxxy = 0x41;
|
||||||
static const int yxxz = 0x81;
|
static const int yxxz = 0x81;
|
||||||
static const int yxxw = 0xC1;
|
static const int yxxw = 0xC1;
|
||||||
|
@ -3001,7 +3016,7 @@ abstract final class Int32x4 {
|
||||||
static const int yxwy = 0x71;
|
static const int yxwy = 0x71;
|
||||||
static const int yxwz = 0xB1;
|
static const int yxwz = 0xB1;
|
||||||
static const int yxww = 0xF1;
|
static const int yxww = 0xF1;
|
||||||
static const int yyxx = 0x5;
|
static const int yyxx = 0x05;
|
||||||
static const int yyxy = 0x45;
|
static const int yyxy = 0x45;
|
||||||
static const int yyxz = 0x85;
|
static const int yyxz = 0x85;
|
||||||
static const int yyxw = 0xC5;
|
static const int yyxw = 0xC5;
|
||||||
|
@ -3017,7 +3032,7 @@ abstract final class Int32x4 {
|
||||||
static const int yywy = 0x75;
|
static const int yywy = 0x75;
|
||||||
static const int yywz = 0xB5;
|
static const int yywz = 0xB5;
|
||||||
static const int yyww = 0xF5;
|
static const int yyww = 0xF5;
|
||||||
static const int yzxx = 0x9;
|
static const int yzxx = 0x09;
|
||||||
static const int yzxy = 0x49;
|
static const int yzxy = 0x49;
|
||||||
static const int yzxz = 0x89;
|
static const int yzxz = 0x89;
|
||||||
static const int yzxw = 0xC9;
|
static const int yzxw = 0xC9;
|
||||||
|
@ -3033,7 +3048,7 @@ abstract final class Int32x4 {
|
||||||
static const int yzwy = 0x79;
|
static const int yzwy = 0x79;
|
||||||
static const int yzwz = 0xB9;
|
static const int yzwz = 0xB9;
|
||||||
static const int yzww = 0xF9;
|
static const int yzww = 0xF9;
|
||||||
static const int ywxx = 0xD;
|
static const int ywxx = 0x0D;
|
||||||
static const int ywxy = 0x4D;
|
static const int ywxy = 0x4D;
|
||||||
static const int ywxz = 0x8D;
|
static const int ywxz = 0x8D;
|
||||||
static const int ywxw = 0xCD;
|
static const int ywxw = 0xCD;
|
||||||
|
@ -3049,7 +3064,7 @@ abstract final class Int32x4 {
|
||||||
static const int ywwy = 0x7D;
|
static const int ywwy = 0x7D;
|
||||||
static const int ywwz = 0xBD;
|
static const int ywwz = 0xBD;
|
||||||
static const int ywww = 0xFD;
|
static const int ywww = 0xFD;
|
||||||
static const int zxxx = 0x2;
|
static const int zxxx = 0x02;
|
||||||
static const int zxxy = 0x42;
|
static const int zxxy = 0x42;
|
||||||
static const int zxxz = 0x82;
|
static const int zxxz = 0x82;
|
||||||
static const int zxxw = 0xC2;
|
static const int zxxw = 0xC2;
|
||||||
|
@ -3065,7 +3080,7 @@ abstract final class Int32x4 {
|
||||||
static const int zxwy = 0x72;
|
static const int zxwy = 0x72;
|
||||||
static const int zxwz = 0xB2;
|
static const int zxwz = 0xB2;
|
||||||
static const int zxww = 0xF2;
|
static const int zxww = 0xF2;
|
||||||
static const int zyxx = 0x6;
|
static const int zyxx = 0x06;
|
||||||
static const int zyxy = 0x46;
|
static const int zyxy = 0x46;
|
||||||
static const int zyxz = 0x86;
|
static const int zyxz = 0x86;
|
||||||
static const int zyxw = 0xC6;
|
static const int zyxw = 0xC6;
|
||||||
|
@ -3081,7 +3096,7 @@ abstract final class Int32x4 {
|
||||||
static const int zywy = 0x76;
|
static const int zywy = 0x76;
|
||||||
static const int zywz = 0xB6;
|
static const int zywz = 0xB6;
|
||||||
static const int zyww = 0xF6;
|
static const int zyww = 0xF6;
|
||||||
static const int zzxx = 0xA;
|
static const int zzxx = 0x0A;
|
||||||
static const int zzxy = 0x4A;
|
static const int zzxy = 0x4A;
|
||||||
static const int zzxz = 0x8A;
|
static const int zzxz = 0x8A;
|
||||||
static const int zzxw = 0xCA;
|
static const int zzxw = 0xCA;
|
||||||
|
@ -3097,7 +3112,7 @@ abstract final class Int32x4 {
|
||||||
static const int zzwy = 0x7A;
|
static const int zzwy = 0x7A;
|
||||||
static const int zzwz = 0xBA;
|
static const int zzwz = 0xBA;
|
||||||
static const int zzww = 0xFA;
|
static const int zzww = 0xFA;
|
||||||
static const int zwxx = 0xE;
|
static const int zwxx = 0x0E;
|
||||||
static const int zwxy = 0x4E;
|
static const int zwxy = 0x4E;
|
||||||
static const int zwxz = 0x8E;
|
static const int zwxz = 0x8E;
|
||||||
static const int zwxw = 0xCE;
|
static const int zwxw = 0xCE;
|
||||||
|
@ -3113,7 +3128,7 @@ abstract final class Int32x4 {
|
||||||
static const int zwwy = 0x7E;
|
static const int zwwy = 0x7E;
|
||||||
static const int zwwz = 0xBE;
|
static const int zwwz = 0xBE;
|
||||||
static const int zwww = 0xFE;
|
static const int zwww = 0xFE;
|
||||||
static const int wxxx = 0x3;
|
static const int wxxx = 0x03;
|
||||||
static const int wxxy = 0x43;
|
static const int wxxy = 0x43;
|
||||||
static const int wxxz = 0x83;
|
static const int wxxz = 0x83;
|
||||||
static const int wxxw = 0xC3;
|
static const int wxxw = 0xC3;
|
||||||
|
@ -3129,7 +3144,7 @@ abstract final class Int32x4 {
|
||||||
static const int wxwy = 0x73;
|
static const int wxwy = 0x73;
|
||||||
static const int wxwz = 0xB3;
|
static const int wxwz = 0xB3;
|
||||||
static const int wxww = 0xF3;
|
static const int wxww = 0xF3;
|
||||||
static const int wyxx = 0x7;
|
static const int wyxx = 0x07;
|
||||||
static const int wyxy = 0x47;
|
static const int wyxy = 0x47;
|
||||||
static const int wyxz = 0x87;
|
static const int wyxz = 0x87;
|
||||||
static const int wyxw = 0xC7;
|
static const int wyxw = 0xC7;
|
||||||
|
@ -3145,7 +3160,7 @@ abstract final class Int32x4 {
|
||||||
static const int wywy = 0x77;
|
static const int wywy = 0x77;
|
||||||
static const int wywz = 0xB7;
|
static const int wywz = 0xB7;
|
||||||
static const int wyww = 0xF7;
|
static const int wyww = 0xF7;
|
||||||
static const int wzxx = 0xB;
|
static const int wzxx = 0x0B;
|
||||||
static const int wzxy = 0x4B;
|
static const int wzxy = 0x4B;
|
||||||
static const int wzxz = 0x8B;
|
static const int wzxz = 0x8B;
|
||||||
static const int wzxw = 0xCB;
|
static const int wzxw = 0xCB;
|
||||||
|
@ -3161,7 +3176,7 @@ abstract final class Int32x4 {
|
||||||
static const int wzwy = 0x7B;
|
static const int wzwy = 0x7B;
|
||||||
static const int wzwz = 0xBB;
|
static const int wzwz = 0xBB;
|
||||||
static const int wzww = 0xFB;
|
static const int wzww = 0xFB;
|
||||||
static const int wwxx = 0xF;
|
static const int wwxx = 0x0F;
|
||||||
static const int wwxy = 0x4F;
|
static const int wwxy = 0x4F;
|
||||||
static const int wwxz = 0x8F;
|
static const int wwxz = 0x8F;
|
||||||
static const int wwxw = 0xCF;
|
static const int wwxw = 0xCF;
|
||||||
|
@ -3234,7 +3249,7 @@ abstract final class Int32x4 {
|
||||||
/// The lanes are "x" and "y" respectively.
|
/// The lanes are "x" and "y" respectively.
|
||||||
///
|
///
|
||||||
/// It is a compile-time error for a class to attempt to extend or implement
|
/// It is a compile-time error for a class to attempt to extend or implement
|
||||||
/// Float64x2.
|
/// `Float64x2`.
|
||||||
abstract final class Float64x2 {
|
abstract final class Float64x2 {
|
||||||
external factory Float64x2(double x, double y);
|
external factory Float64x2(double x, double y);
|
||||||
external factory Float64x2.splat(double v);
|
external factory Float64x2.splat(double v);
|
||||||
|
@ -3262,7 +3277,7 @@ abstract final class Float64x2 {
|
||||||
/// Equivalent to this * new Float64x2.splat(s)
|
/// Equivalent to this * new Float64x2.splat(s)
|
||||||
Float64x2 scale(double s);
|
Float64x2 scale(double s);
|
||||||
|
|
||||||
/// Returns the lane-wise absolute value of this [Float64x2].
|
/// The lane-wise absolute value of this [Float64x2].
|
||||||
Float64x2 abs();
|
Float64x2 abs();
|
||||||
|
|
||||||
/// Lane-wise clamp this [Float64x2] to be in the range
|
/// Lane-wise clamp this [Float64x2] to be in the range
|
||||||
|
@ -3288,12 +3303,12 @@ abstract final class Float64x2 {
|
||||||
/// value.
|
/// value.
|
||||||
Float64x2 withY(double y);
|
Float64x2 withY(double y);
|
||||||
|
|
||||||
/// Returns the lane-wise minimum value in this [Float64x2] or [other].
|
/// The lane-wise minimum value in this [Float64x2] or [other].
|
||||||
Float64x2 min(Float64x2 other);
|
Float64x2 min(Float64x2 other);
|
||||||
|
|
||||||
/// Returns the lane-wise maximum value in this [Float64x2] or [other].
|
/// The lane-wise maximum value in this [Float64x2] or [other].
|
||||||
Float64x2 max(Float64x2 other);
|
Float64x2 max(Float64x2 other);
|
||||||
|
|
||||||
/// Returns the lane-wise square root of this [Float64x2].
|
/// The lane-wise square root of this [Float64x2].
|
||||||
Float64x2 sqrt();
|
Float64x2 sqrt();
|
||||||
}
|
}
|
||||||
|
|
180
tests/lib/typed_data/typed_data_interface_test.dart
Normal file
180
tests/lib/typed_data/typed_data_interface_test.dart
Normal file
|
@ -0,0 +1,180 @@
|
||||||
|
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
|
||||||
|
// for details. All rights reserved. Use of this source code is governed by a
|
||||||
|
// BSD-style license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
import 'dart:typed_data';
|
||||||
|
import 'package:expect/expect.dart';
|
||||||
|
import 'package:expect/variations.dart';
|
||||||
|
|
||||||
|
// The `TypedData` interface has the following properties:
|
||||||
|
// * `buffer`
|
||||||
|
// * `offsetInBytes`
|
||||||
|
// * `lengthInBytes`
|
||||||
|
// * `elementSizeInBytes`
|
||||||
|
|
||||||
|
@pragma('dart2js:assumeDynamic')
|
||||||
|
@pragma('dart2js:noInline')
|
||||||
|
confuse(x) => x;
|
||||||
|
|
||||||
|
void test(TypedData data, int bytesPerElement, int lengthInBytes) {
|
||||||
|
var type = data.runtimeType.toString();
|
||||||
|
Expect.equals(
|
||||||
|
bytesPerElement, data.elementSizeInBytes, "$type.elementSizeInBytes");
|
||||||
|
Expect.equals(lengthInBytes, data.lengthInBytes, "$type.lengthInBytes");
|
||||||
|
// Always aligned.
|
||||||
|
Expect.equals(0, data.offsetInBytes % bytesPerElement, "$type alignment");
|
||||||
|
if (data is TypedDataList) {
|
||||||
|
Expect.equals(
|
||||||
|
lengthInBytes ~/ bytesPerElement, data.length, "$type.length");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
// Reusable buffer
|
||||||
|
var typedList = Uint8List(128);
|
||||||
|
var buffer = typedList.buffer;
|
||||||
|
|
||||||
|
for (var bytes in [0, 16, 64]) {
|
||||||
|
int size;
|
||||||
|
|
||||||
|
size = 1; // No ByteData.bytesPerElement.
|
||||||
|
test(ByteData(bytes), size, bytes);
|
||||||
|
test(ByteData.view(buffer, 32, bytes), size, bytes);
|
||||||
|
test(ByteData.sublistView(typedList, 32, 32 + bytes * size), size, bytes);
|
||||||
|
|
||||||
|
size = Uint8List.bytesPerElement;
|
||||||
|
Expect.equals(1, size);
|
||||||
|
test(Uint8List(bytes), size, bytes);
|
||||||
|
test(Uint8List.view(buffer, 32, bytes), size, bytes);
|
||||||
|
test(Uint8List.sublistView(typedList, 32, 32 + bytes * size), size, bytes);
|
||||||
|
|
||||||
|
size = Int8List.bytesPerElement;
|
||||||
|
Expect.equals(1, size);
|
||||||
|
test(Int8List(bytes), size, bytes);
|
||||||
|
test(Int8List.view(buffer, 32, bytes), size, bytes);
|
||||||
|
test(Int8List.sublistView(typedList, 32, 32 + bytes * size), size, bytes);
|
||||||
|
|
||||||
|
size = Uint8ClampedList.bytesPerElement;
|
||||||
|
Expect.equals(1, size);
|
||||||
|
test(Uint8ClampedList(bytes), size, bytes);
|
||||||
|
test(Uint8ClampedList.view(buffer, 32, bytes), size, bytes);
|
||||||
|
test(Uint8ClampedList.sublistView(typedList, 32, 32 + bytes * size), size,
|
||||||
|
bytes);
|
||||||
|
|
||||||
|
size = Uint16List.bytesPerElement;
|
||||||
|
Expect.equals(2, size);
|
||||||
|
test(Uint16List(bytes ~/ 2), size, bytes);
|
||||||
|
test(Uint16List.view(buffer, 32, bytes ~/ 2), size, bytes);
|
||||||
|
test(Uint16List.sublistView(typedList, 32, 32 + bytes * size ~/ 2), size,
|
||||||
|
bytes);
|
||||||
|
|
||||||
|
size = Int16List.bytesPerElement;
|
||||||
|
Expect.equals(2, size);
|
||||||
|
test(Int16List(bytes ~/ 2), size, bytes);
|
||||||
|
test(Int16List.view(buffer, 32, bytes ~/ 2), size, bytes);
|
||||||
|
test(Int16List.sublistView(typedList, 32, 32 + bytes * size ~/ 2), size,
|
||||||
|
bytes);
|
||||||
|
|
||||||
|
size = Uint32List.bytesPerElement;
|
||||||
|
Expect.equals(4, size);
|
||||||
|
test(Uint32List(bytes ~/ 4), size, bytes);
|
||||||
|
test(Uint32List.view(buffer, 32, bytes ~/ 4), size, bytes);
|
||||||
|
test(Uint32List.sublistView(typedList, 32, 32 + bytes * size ~/ 4), size,
|
||||||
|
bytes);
|
||||||
|
|
||||||
|
size = Int32List.bytesPerElement;
|
||||||
|
Expect.equals(4, size);
|
||||||
|
test(Int32List(bytes ~/ 4), size, bytes);
|
||||||
|
test(Int32List.view(buffer, 32, bytes ~/ 4), size, bytes);
|
||||||
|
test(Int32List.sublistView(typedList, 32, 32 + bytes * size ~/ 4), size,
|
||||||
|
bytes);
|
||||||
|
|
||||||
|
if (!jsNumbers) {
|
||||||
|
size = Uint64List.bytesPerElement;
|
||||||
|
Expect.equals(8, size);
|
||||||
|
test(Uint64List(bytes ~/ 8), size, bytes);
|
||||||
|
test(Uint64List.view(buffer, 32, bytes ~/ 8), size, bytes);
|
||||||
|
test(Uint64List.sublistView(typedList, 32, 32 + bytes * size ~/ 8), size,
|
||||||
|
bytes);
|
||||||
|
|
||||||
|
size = Int64List.bytesPerElement;
|
||||||
|
Expect.equals(8, size);
|
||||||
|
test(Int64List(bytes ~/ 8), size, bytes);
|
||||||
|
test(Int64List.view(buffer, 32, bytes ~/ 8), size, bytes);
|
||||||
|
test(Int64List.sublistView(typedList, 32, 32 + bytes * size ~/ 8), size,
|
||||||
|
bytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
size = Float32List.bytesPerElement;
|
||||||
|
Expect.equals(4, size);
|
||||||
|
test(Float32List(bytes ~/ 4), size, bytes);
|
||||||
|
test(Float32List.view(buffer, 32, bytes ~/ 4), size, bytes);
|
||||||
|
test(Float32List.sublistView(typedList, 32, 32 + bytes * size ~/ 4), size,
|
||||||
|
bytes);
|
||||||
|
|
||||||
|
size = Float64List.bytesPerElement;
|
||||||
|
Expect.equals(8, size);
|
||||||
|
test(Float64List(bytes ~/ 8), size, bytes);
|
||||||
|
test(Float64List.view(buffer, 32, bytes ~/ 8), size, bytes);
|
||||||
|
test(Float64List.sublistView(typedList, 32, 32 + bytes * size ~/ 8), size,
|
||||||
|
bytes);
|
||||||
|
|
||||||
|
size = Int32x4List.bytesPerElement;
|
||||||
|
Expect.equals(16, size);
|
||||||
|
test(Int32x4List(bytes ~/ 16), size, bytes);
|
||||||
|
test(Int32x4List.view(buffer, 32, bytes ~/ 16), size, bytes);
|
||||||
|
test(Int32x4List.sublistView(typedList, 32, 32 + bytes * size ~/ 16), size,
|
||||||
|
bytes);
|
||||||
|
|
||||||
|
size = Float32x4List.bytesPerElement;
|
||||||
|
Expect.equals(16, size);
|
||||||
|
test(Float32x4List(bytes ~/ 16), size, bytes);
|
||||||
|
test(Float32x4List.view(buffer, 32, bytes ~/ 16), size, bytes);
|
||||||
|
test(Float32x4List.sublistView(typedList, 32, 32 + bytes * size ~/ 16),
|
||||||
|
size, bytes);
|
||||||
|
|
||||||
|
size = Float64x2List.bytesPerElement;
|
||||||
|
Expect.equals(16, size);
|
||||||
|
test(Float64x2List(bytes ~/ 16), size, bytes);
|
||||||
|
test(Float64x2List.view(buffer, 32, bytes ~/ 16), size, bytes);
|
||||||
|
test(Float64x2List.sublistView(typedList, 32, 32 + bytes * size ~/ 16),
|
||||||
|
size, bytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
var oddSize = 64 + 7;
|
||||||
|
var oddList = Uint8List(oddSize);
|
||||||
|
var oddBuffer = oddList.buffer;
|
||||||
|
// View truncates to multiple of `lengthInBytes`.
|
||||||
|
int roundTo(int num, int mod) => num - (num % mod);
|
||||||
|
Expect.equals(oddSize, ByteData.view(oddBuffer).lengthInBytes);
|
||||||
|
Expect.equals(roundTo(oddSize, Uint8List.bytesPerElement),
|
||||||
|
Uint8List.view(oddBuffer).lengthInBytes);
|
||||||
|
Expect.equals(roundTo(oddSize, Int8List.bytesPerElement),
|
||||||
|
Int8List.view(oddBuffer).lengthInBytes);
|
||||||
|
Expect.equals(roundTo(oddSize, Uint8ClampedList.bytesPerElement),
|
||||||
|
Uint8ClampedList.view(oddBuffer).lengthInBytes);
|
||||||
|
Expect.equals(roundTo(oddSize, Uint16List.bytesPerElement),
|
||||||
|
Uint16List.view(oddBuffer).lengthInBytes);
|
||||||
|
Expect.equals(roundTo(oddSize, Int16List.bytesPerElement),
|
||||||
|
Int16List.view(oddBuffer).lengthInBytes);
|
||||||
|
Expect.equals(roundTo(oddSize, Uint32List.bytesPerElement),
|
||||||
|
Uint32List.view(oddBuffer).lengthInBytes);
|
||||||
|
Expect.equals(roundTo(oddSize, Int32List.bytesPerElement),
|
||||||
|
Int32List.view(oddBuffer).lengthInBytes);
|
||||||
|
if (!jsNumbers) {
|
||||||
|
Expect.equals(roundTo(oddSize, Uint64List.bytesPerElement),
|
||||||
|
Uint64List.view(oddBuffer).lengthInBytes);
|
||||||
|
Expect.equals(roundTo(oddSize, Int64List.bytesPerElement),
|
||||||
|
Int64List.view(oddBuffer).lengthInBytes);
|
||||||
|
}
|
||||||
|
Expect.equals(roundTo(oddSize, Float32List.bytesPerElement),
|
||||||
|
Float32List.view(oddBuffer).lengthInBytes);
|
||||||
|
Expect.equals(roundTo(oddSize, Float64List.bytesPerElement),
|
||||||
|
Float64List.view(oddBuffer).lengthInBytes);
|
||||||
|
Expect.equals(roundTo(oddSize, Int32x4List.bytesPerElement),
|
||||||
|
Int32x4List.view(oddBuffer).lengthInBytes);
|
||||||
|
Expect.equals(roundTo(oddSize, Float32x4List.bytesPerElement),
|
||||||
|
Float32x4List.view(oddBuffer).lengthInBytes);
|
||||||
|
Expect.equals(roundTo(oddSize, Float64x2List.bytesPerElement),
|
||||||
|
Float64x2List.view(oddBuffer).lengthInBytes);
|
||||||
|
}
|
|
@ -298,7 +298,8 @@ void testGetAtIndex(TypedData list, num initial_value) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void testSetAtIndex(List list, num initial_value, [bool use_double = false]) {
|
void testSetAtIndex(TypedDataList list, num initial_value,
|
||||||
|
[bool use_double = false]) {
|
||||||
void validate([reinit = true]) {
|
void validate([reinit = true]) {
|
||||||
for (int i = 0; i < list.length; i++) {
|
for (int i = 0; i < list.length; i++) {
|
||||||
Expect.equals(initial_value, list[i]);
|
Expect.equals(initial_value, list[i]);
|
||||||
|
@ -306,7 +307,7 @@ void testSetAtIndex(List list, num initial_value, [bool use_double = false]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var bdata = new ByteData.view((list as TypedData).buffer);
|
var bdata = new ByteData.view(list.buffer);
|
||||||
for (int i = 0; i < bdata.lengthInBytes; i++) {
|
for (int i = 0; i < bdata.lengthInBytes; i++) {
|
||||||
bdata.setUint8(i, 42);
|
bdata.setUint8(i, 42);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue