OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #ifndef PLATFORM_GLOBALS_H_ | 5 #ifndef PLATFORM_GLOBALS_H_ |
6 #define PLATFORM_GLOBALS_H_ | 6 #define PLATFORM_GLOBALS_H_ |
7 | 7 |
8 // __STDC_FORMAT_MACROS has to be defined before including <inttypes.h> to | 8 // __STDC_FORMAT_MACROS has to be defined before including <inttypes.h> to |
9 // enable platform independent printf format specifiers. | 9 // enable platform independent printf format specifiers. |
10 #ifndef __STDC_FORMAT_MACROS | 10 #ifndef __STDC_FORMAT_MACROS |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 74 |
75 struct simd128_value_t { | 75 struct simd128_value_t { |
76 float storage[4]; | 76 float storage[4]; |
77 simd128_value_t& readFrom(const float* v) { | 77 simd128_value_t& readFrom(const float* v) { |
78 storage[0] = v[0]; | 78 storage[0] = v[0]; |
79 storage[1] = v[1]; | 79 storage[1] = v[1]; |
80 storage[2] = v[2]; | 80 storage[2] = v[2]; |
81 storage[3] = v[3]; | 81 storage[3] = v[3]; |
82 return *this; | 82 return *this; |
83 } | 83 } |
84 simd128_value_t& readFrom(const uint32_t* v) { | 84 simd128_value_t& readFrom(const int32_t* v) { |
85 const float* vv = reinterpret_cast<const float*>(v); | 85 const float* vv = reinterpret_cast<const float*>(v); |
86 storage[0] = vv[0]; | 86 storage[0] = vv[0]; |
87 storage[1] = vv[1]; | 87 storage[1] = vv[1]; |
88 storage[2] = vv[2]; | 88 storage[2] = vv[2]; |
89 storage[3] = vv[3]; | 89 storage[3] = vv[3]; |
90 return *this; | 90 return *this; |
91 } | 91 } |
92 simd128_value_t& readFrom(const simd128_value_t* v) { | 92 simd128_value_t& readFrom(const simd128_value_t* v) { |
93 *this = *v; | 93 *this = *v; |
94 return *this; | 94 return *this; |
95 } | 95 } |
96 void writeTo(float* v) { | 96 void writeTo(float* v) { |
97 v[0] = storage[0]; | 97 v[0] = storage[0]; |
98 v[1] = storage[1]; | 98 v[1] = storage[1]; |
99 v[2] = storage[2]; | 99 v[2] = storage[2]; |
100 v[3] = storage[3]; | 100 v[3] = storage[3]; |
101 } | 101 } |
102 void writeTo(uint32_t* v) { | 102 void writeTo(int32_t* v) { |
103 float* vv = reinterpret_cast<float*>(v); | 103 float* vv = reinterpret_cast<float*>(v); |
104 vv[0] = storage[0]; | 104 vv[0] = storage[0]; |
105 vv[1] = storage[1]; | 105 vv[1] = storage[1]; |
106 vv[2] = storage[2]; | 106 vv[2] = storage[2]; |
107 vv[3] = storage[3]; | 107 vv[3] = storage[3]; |
108 } | 108 } |
109 void writeTo(simd128_value_t* v) { | 109 void writeTo(simd128_value_t* v) { |
110 *v = *this; | 110 *v = *this; |
111 } | 111 } |
112 }; | 112 }; |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 // N.B.: As the GCC manual states, "[s]ince non-static C++ methods | 461 // N.B.: As the GCC manual states, "[s]ince non-static C++ methods |
462 // have an implicit 'this' argument, the arguments of such methods | 462 // have an implicit 'this' argument, the arguments of such methods |
463 // should be counted from two, not one." | 463 // should be counted from two, not one." |
464 #define PRINTF_ATTRIBUTE(string_index, first_to_check) \ | 464 #define PRINTF_ATTRIBUTE(string_index, first_to_check) \ |
465 __attribute__((__format__(__printf__, string_index, first_to_check))) | 465 __attribute__((__format__(__printf__, string_index, first_to_check))) |
466 #else | 466 #else |
467 #define PRINTF_ATTRIBUTE(string_index, first_to_check) | 467 #define PRINTF_ATTRIBUTE(string_index, first_to_check) |
468 #endif | 468 #endif |
469 | 469 |
470 #endif // PLATFORM_GLOBALS_H_ | 470 #endif // PLATFORM_GLOBALS_H_ |
OLD | NEW |