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

Unified Diff: runtime/platform/globals.h

Issue 138203003: Mark simd128_value_t as able to containing both float and int32_t. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/platform/globals.h
diff --git a/runtime/platform/globals.h b/runtime/platform/globals.h
index 9e27506dd2b77ee001cd26958b8115a8b7753345..d07963cce70f995063b15f807c07bb265b3b95f6 100644
--- a/runtime/platform/globals.h
+++ b/runtime/platform/globals.h
@@ -73,7 +73,10 @@
#endif
struct simd128_value_t {
- float storage[4];
+ union {
+ float storage[4];
kasperl 2014/01/29 14:07:50 Rename to float_storage?
Anders Johnsen 2014/01/29 14:21:20 Done.
+ int32_t int_storage[4];
+ };
simd128_value_t& readFrom(const float* v) {
storage[0] = v[0];
storage[1] = v[1];
@@ -82,11 +85,10 @@ struct simd128_value_t {
return *this;
}
simd128_value_t& readFrom(const int32_t* v) {
- const float* vv = reinterpret_cast<const float*>(v);
- storage[0] = vv[0];
- storage[1] = vv[1];
- storage[2] = vv[2];
- storage[3] = vv[3];
+ int_storage[0] = v[0];
+ int_storage[1] = v[1];
+ int_storage[2] = v[2];
+ int_storage[3] = v[3];
return *this;
}
simd128_value_t& readFrom(const simd128_value_t* v) {
@@ -100,11 +102,10 @@ struct simd128_value_t {
v[3] = storage[3];
}
void writeTo(int32_t* v) {
- float* vv = reinterpret_cast<float*>(v);
- vv[0] = storage[0];
- vv[1] = storage[1];
- vv[2] = storage[2];
- vv[3] = storage[3];
+ v[0] = int_storage[0];
+ v[1] = int_storage[1];
+ v[2] = int_storage[2];
+ v[3] = int_storage[3];
}
void writeTo(simd128_value_t* v) {
*v = *this;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698