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

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
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 a145ff2eac91a63c9a75cfcc68be798464d1f65b..c3c31363b9c5c6f60caffbccb9e7bf3af5e3ae4e 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) {
@@ -1405,6 +1414,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;

Powered by Google App Engine
This is Rietveld 408576698