Chromium Code Reviews| 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; |