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

Unified Diff: sdk/lib/typed_data/dart2js/typed_data_dart2js.dart

Issue 22947006: Add signMask getter to Float32x4 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/intermediate_language_x64.cc ('k') | sdk/lib/typed_data/typed_data.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/typed_data/dart2js/typed_data_dart2js.dart
diff --git a/sdk/lib/typed_data/dart2js/typed_data_dart2js.dart b/sdk/lib/typed_data/dart2js/typed_data_dart2js.dart
index 31d2548bf9fa33de7881f21b24d5466d9651727c..c72a299b91589ac31b14534d022fe5654f8c92a2 100644
--- a/sdk/lib/typed_data/dart2js/typed_data_dart2js.dart
+++ b/sdk/lib/typed_data/dart2js/typed_data_dart2js.dart
@@ -934,6 +934,16 @@ class Float32x4 {
/// Extracted w value.
double get w => _storage[3];
+ /// Extract the sign bit from each lane return them in the first 4 bits.
+ int get signMask {
+ var view = new Uint32List.view(_storage.buffer);
+ var mx = (view[0] & 0x80000000) >> 31;
+ var my = (view[1] & 0x80000000) >> 31;
+ var mz = (view[2] & 0x80000000) >> 31;
+ var mw = (view[3] & 0x80000000) >> 31;
+ return mx | my << 1 | mz << 2 | mw << 3;
+ }
+
/// Mask passed to [shuffle].
static const int XXXX = 0x0;
static const int XXXY = 0x40;
@@ -1192,7 +1202,6 @@ class Float32x4 {
static const int WWWZ = 0xBF;
static const int WWWW = 0xFF;
-
/// Shuffle the lane values. [mask] must be one of the 256 shuffle constants.
Float32x4 shuffle(int m) {
if (m < 0 || m > 255) {
@@ -1423,6 +1432,15 @@ class Uint32x4 {
/// Extract 32-bit mask from w lane.
int get w => _storage[3];
+ /// Extract the top bit from each lane return them in the first 4 bits.
+ int get signMask {
+ int mx = (_storage[0] & 0x80000000) >> 31;
+ int my = (_storage[1] & 0x80000000) >> 31;
+ int mz = (_storage[2] & 0x80000000) >> 31;
+ int mw = (_storage[3] & 0x80000000) >> 31;
+ return mx | my << 1 | mz << 2 | mw << 3;
+ }
+
/// Returns a new [Uint32x4] copied from [this] with a new x value.
Uint32x4 withX(int x) {
int _x = x;
« no previous file with comments | « runtime/vm/intermediate_language_x64.cc ('k') | sdk/lib/typed_data/typed_data.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698