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

Side by Side Diff: runtime/lib/typed_data.dart

Issue 24240020: Cleanup bit casting methods between SIMD types (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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
« no previous file with comments | « runtime/lib/simd128.cc ('k') | runtime/vm/bootstrap_natives.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // patch classes for Int8List ..... Float64List and ByteData implementations. 5 // patch classes for Int8List ..... Float64List and ByteData implementations.
6 6
7 patch class Int8List { 7 patch class Int8List {
8 /* patch */ factory Int8List(int length) { 8 /* patch */ factory Int8List(int length) {
9 return new _Int8Array(length); 9 return new _Int8Array(length);
10 } 10 }
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 patch class Float32x4 { 247 patch class Float32x4 {
248 /* patch */ factory Float32x4(double x, double y, double z, double w) { 248 /* patch */ factory Float32x4(double x, double y, double z, double w) {
249 return new _Float32x4(x, y, z, w); 249 return new _Float32x4(x, y, z, w);
250 } 250 }
251 /* patch */ factory Float32x4.splat(double v) { 251 /* patch */ factory Float32x4.splat(double v) {
252 return new _Float32x4.splat(v); 252 return new _Float32x4.splat(v);
253 } 253 }
254 /* patch */ factory Float32x4.zero() { 254 /* patch */ factory Float32x4.zero() {
255 return new _Float32x4.zero(); 255 return new _Float32x4.zero();
256 } 256 }
257 /* patch */ factory Float32x4.fromUint32x4Bits(Uint32x4 x) {
258 return new _Float32x4.fromUint32x4Bits(x);
259 }
257 } 260 }
258 261
259 262
260 patch class Uint32x4 { 263 patch class Uint32x4 {
261 /* patch */ factory Uint32x4(int x, int y, int z, int w) { 264 /* patch */ factory Uint32x4(int x, int y, int z, int w) {
262 return new _Uint32x4(x, y, z, w); 265 return new _Uint32x4(x, y, z, w);
263 } 266 }
264 /* patch */ factory Uint32x4.bool(bool x, bool y, bool z, bool w) { 267 /* patch */ factory Uint32x4.bool(bool x, bool y, bool z, bool w) {
265 return new _Uint32x4.bool(x, y, z, w); 268 return new _Uint32x4.bool(x, y, z, w);
266 } 269 }
270 /* patch */ factory Uint32x4.fromFloat32x4Bits(Float32x4 x) {
271 return new _Uint32x4.fromFloat32x4Bits(x);
272 }
267 } 273 }
268 274
269 275
270 patch class ByteData { 276 patch class ByteData {
271 /* patch */ factory ByteData(int length) { 277 /* patch */ factory ByteData(int length) {
272 var list = new _Uint8Array(length); 278 var list = new _Uint8Array(length);
273 return new _ByteDataView(list.buffer, 0, length); 279 return new _ByteDataView(list.buffer, 0, length);
274 } 280 }
275 281
276 /* patch */ factory ByteData.view(ByteBuffer buffer, 282 /* patch */ factory ByteData.view(ByteBuffer buffer,
(...skipping 1663 matching lines...) Expand 10 before | Expand all | Expand 10 after
1940 static _ExternalFloat32x4Array _new(int length) native 1946 static _ExternalFloat32x4Array _new(int length) native
1941 "ExternalTypedData_Float32x4Array_new"; 1947 "ExternalTypedData_Float32x4Array_new";
1942 } 1948 }
1943 1949
1944 1950
1945 class _Float32x4 implements Float32x4 { 1951 class _Float32x4 implements Float32x4 {
1946 factory _Float32x4(double x, double y, double z, double w) 1952 factory _Float32x4(double x, double y, double z, double w)
1947 native "Float32x4_fromDoubles"; 1953 native "Float32x4_fromDoubles";
1948 factory _Float32x4.splat(double v) native "Float32x4_splat"; 1954 factory _Float32x4.splat(double v) native "Float32x4_splat";
1949 factory _Float32x4.zero() native "Float32x4_zero"; 1955 factory _Float32x4.zero() native "Float32x4_zero";
1956 factory _Float32x4.fromUint32x4Bits(Uint32x4 x)
1957 native "Float32x4_fromUint32x4Bits";
1950 Float32x4 operator +(Float32x4 other) { 1958 Float32x4 operator +(Float32x4 other) {
1951 return _add(other); 1959 return _add(other);
1952 } 1960 }
1953 Float32x4 _add(Float32x4 other) native "Float32x4_add"; 1961 Float32x4 _add(Float32x4 other) native "Float32x4_add";
1954 Float32x4 operator -() { 1962 Float32x4 operator -() {
1955 return _negate(); 1963 return _negate();
1956 } 1964 }
1957 Float32x4 _negate() native "Float32x4_negate"; 1965 Float32x4 _negate() native "Float32x4_negate";
1958 Float32x4 operator -(Float32x4 other) { 1966 Float32x4 operator -(Float32x4 other) {
1959 return _sub(other); 1967 return _sub(other);
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
2041 } 2049 }
2042 Float32x4 _sqrt() native "Float32x4_sqrt"; 2050 Float32x4 _sqrt() native "Float32x4_sqrt";
2043 Float32x4 reciprocal() { 2051 Float32x4 reciprocal() {
2044 return _reciprocal(); 2052 return _reciprocal();
2045 } 2053 }
2046 Float32x4 _reciprocal() native "Float32x4_reciprocal"; 2054 Float32x4 _reciprocal() native "Float32x4_reciprocal";
2047 Float32x4 reciprocalSqrt() { 2055 Float32x4 reciprocalSqrt() {
2048 return _reciprocalSqrt(); 2056 return _reciprocalSqrt();
2049 } 2057 }
2050 Float32x4 _reciprocalSqrt() native "Float32x4_reciprocalSqrt"; 2058 Float32x4 _reciprocalSqrt() native "Float32x4_reciprocalSqrt";
2051 Uint32x4 toUint32x4() {
2052 return _toUint32x4();
2053 }
2054 Uint32x4 _toUint32x4() native "Float32x4_toUint32x4";
2055 } 2059 }
2056 2060
2057 2061
2058 class _Uint32x4 implements Uint32x4 { 2062 class _Uint32x4 implements Uint32x4 {
2059 factory _Uint32x4(int x, int y, int z, int w) 2063 factory _Uint32x4(int x, int y, int z, int w)
2060 native "Uint32x4_fromInts"; 2064 native "Uint32x4_fromInts";
2061 factory _Uint32x4.bool(bool x, bool y, bool z, bool w) 2065 factory _Uint32x4.bool(bool x, bool y, bool z, bool w)
2062 native "Uint32x4_fromBools"; 2066 native "Uint32x4_fromBools";
2067 factory _Uint32x4.fromFloat32x4Bits(Float32x4 x)
2068 native "Uint32x4_fromFloat32x4Bits";
2063 Uint32x4 operator |(Uint32x4 other) { 2069 Uint32x4 operator |(Uint32x4 other) {
2064 return _or(other); 2070 return _or(other);
2065 } 2071 }
2066 Uint32x4 _or(Uint32x4 other) native "Uint32x4_or"; 2072 Uint32x4 _or(Uint32x4 other) native "Uint32x4_or";
2067 Uint32x4 operator &(Uint32x4 other) { 2073 Uint32x4 operator &(Uint32x4 other) {
2068 return _and(other); 2074 return _and(other);
2069 } 2075 }
2070 Uint32x4 _and(Uint32x4 other) native "Uint32x4_and"; 2076 Uint32x4 _and(Uint32x4 other) native "Uint32x4_and";
2071 Uint32x4 operator ^(Uint32x4 other) { 2077 Uint32x4 operator ^(Uint32x4 other) {
2072 return _xor(other); 2078 return _xor(other);
(...skipping 24 matching lines...) Expand all
2097 Uint32x4 withFlagY(bool y) native "Uint32x4_setFlagY"; 2103 Uint32x4 withFlagY(bool y) native "Uint32x4_setFlagY";
2098 Uint32x4 withFlagZ(bool z) native "Uint32x4_setFlagZ"; 2104 Uint32x4 withFlagZ(bool z) native "Uint32x4_setFlagZ";
2099 Uint32x4 withFlagW(bool w) native "Uint32x4_setFlagW"; 2105 Uint32x4 withFlagW(bool w) native "Uint32x4_setFlagW";
2100 Float32x4 select(Float32x4 trueValue, 2106 Float32x4 select(Float32x4 trueValue,
2101 Float32x4 falseValue) { 2107 Float32x4 falseValue) {
2102 return _select(trueValue, falseValue); 2108 return _select(trueValue, falseValue);
2103 } 2109 }
2104 Float32x4 _select(Float32x4 trueValue, 2110 Float32x4 _select(Float32x4 trueValue,
2105 Float32x4 falseValue) 2111 Float32x4 falseValue)
2106 native "Uint32x4_select"; 2112 native "Uint32x4_select";
2107 Float32x4 toFloat32x4() {
2108 return _toFloat32x4();
2109 }
2110 Float32x4 _toFloat32x4() native "Uint32x4_toFloat32x4";
2111 } 2113 }
2112 2114
2113 class _TypedListIterator<E> implements Iterator<E> { 2115 class _TypedListIterator<E> implements Iterator<E> {
2114 final List<E> _array; 2116 final List<E> _array;
2115 final int _length; 2117 final int _length;
2116 int _position; 2118 int _position;
2117 E _current; 2119 E _current;
2118 2120
2119 _TypedListIterator(List array) 2121 _TypedListIterator(List array)
2120 : _array = array, _length = array.length, _position = -1 { 2122 : _array = array, _length = array.length, _position = -1 {
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after
3147 return value; 3149 return value;
3148 } 3150 }
3149 return object; 3151 return object;
3150 } 3152 }
3151 3153
3152 3154
3153 void _throwRangeError(int index, int length) { 3155 void _throwRangeError(int index, int length) {
3154 String message = "$index must be in the range [0..$length)"; 3156 String message = "$index must be in the range [0..$length)";
3155 throw new RangeError(message); 3157 throw new RangeError(message);
3156 } 3158 }
OLDNEW
« no previous file with comments | « runtime/lib/simd128.cc ('k') | runtime/vm/bootstrap_natives.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698