Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(365)

Side by Side Diff: sdk/lib/typeddata/typeddata_base.dart

Issue 12534006: Port SIMD types from dart:scalarlist to dart:typeddata. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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.typeddata; 5 part of dart.typeddata;
6 6
7 /** 7 /**
8 * A sequence of bytes underlying a typed data object. 8 * A sequence of bytes underlying a typed data object.
9 * Used to process large quantities of binary or numerical data 9 * Used to process large quantities of binary or numerical data
10 * more efficiently using a typed view. 10 * more efficiently using a typed view.
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 302
303 /** 303 /**
304 * Sets the eight bytes starting at the specified [byteOffset] in this 304 * Sets the eight bytes starting at the specified [byteOffset] in this
305 * object to the IEEE 754 double-precision binary floating-point 305 * object to the IEEE 754 double-precision binary floating-point
306 * (binary64) representation of the specified [value]. 306 * (binary64) representation of the specified [value].
307 * 307 *
308 * Throws [RangeError] if [byteOffset] is negative, or 308 * Throws [RangeError] if [byteOffset] is negative, or
309 * `byteOffset + 8` is greater than the length of this object. 309 * `byteOffset + 8` is greater than the length of this object.
310 */ 310 */
311 void setFloat64(int byteOffset, double value); 311 void setFloat64(int byteOffset, double value);
312
313 /**
314 * Returns the 4 floating point numbers represented by the sixteen bytes at
315 * the specified [byteOffset] in this object, in IEEE 754
316 * single-precision binary floating-point format (binary32).
317 *
318 * Throws [RangeError] if [byteOffset] is negative, or
319 * `byteOffset + 16` is greater than the length of this object.
320 */
321 Float32x4 getFloat32x4(int byteOffset);
322
323 /**
324 * Sets the sixteen bytes starting at the specified [byteOffset] in this
325 * object to the 4 IEEE 754 single-precision binary floating-point
326 * (binary32) numbers of the specified [value].
327 *
328 * Throws [RangeError] if [byteOffset] is negative, or
329 * `byteOffset + 16` is greater than the length of this object.
330 */
331 void setFloat32x4(int byteOffset, Float32x4 value);
312 } 332 }
313 333
314 334
315 /** 335 /**
316 * A fixed-length list of 8-bit signed integers. 336 * A fixed-length list of 8-bit signed integers.
317 * For long lists, this implementation can be considerably 337 * For long lists, this implementation can be considerably
318 * more space- and time-efficient than the default [List] implementation. 338 * more space- and time-efficient than the default [List] implementation.
319 */ 339 */
320 abstract class Int8List implements List<int>, TypedData { 340 abstract class Int8List implements List<int>, TypedData {
321 /** 341 /**
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 * the length of [buffer]. 692 * the length of [buffer].
673 * 693 *
674 * Throws [ArgumentError] if [offsetInBytes] is not a multiple of 694 * Throws [ArgumentError] if [offsetInBytes] is not a multiple of
675 * BYTES_PER_ELEMENT. 695 * BYTES_PER_ELEMENT.
676 */ 696 */
677 external factory Float64List.view(ByteBuffer buffer, 697 external factory Float64List.view(ByteBuffer buffer,
678 [int offsetInBytes = 0, int length]); 698 [int offsetInBytes = 0, int length]);
679 699
680 static const int BYTES_PER_ELEMENT = 8; 700 static const int BYTES_PER_ELEMENT = 8;
681 } 701 }
702
703 /**
704 * A fixed-length list of Float32x4 numbers that is viewable as a
705 * [TypedData]. For long lists, this implementation will be considerably more
706 * space- and time-efficient than the default [List] implementation.
707 */
708 abstract class Float32x4List implements List<Float32x4>, TypedData {
709 /**
710 * Creates a [Float32x4List] of the specified length (in elements),
711 * all of whose elements are initially zero.
712 */
713 external factory Float32x4List(int length);
714
715 /**
716 * Creates a [Float32x4List] _view_ of the specified region in the specified
717 * byte buffer. Changes in the [Float32x4List] will be visible in the byte
718 * buffer and vice versa. If the [offsetInBytes] index of the region is not
719 * specified, it defaults to zero (the first byte in the byte buffer).
720 * If the length is not specified, it defaults to null, which indicates
721 * that the view extends to the end of the byte buffer.
722 *
723 * Throws [RangeError] if [offsetInBytes] or [length] are negative, or
724 * if [offsetInBytes] + ([length] * elementSizeInBytes) is greater than
725 * the length of [buffer].
726 *
727 * Throws [ArgumentError] if [offsetInBytes] is not a multiple of
728 * BYTES_PER_ELEMENT.
729 */
730 external factory Float32x4List.view(ByteBuffer buffer,
731 [int offsetInBytes = 0, int length]);
732
733 static const int BYTES_PER_ELEMENT = 16;
734 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698