| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 return *this; | 82 return *this; |
| 83 } | 83 } |
| 84 simd128_value_t& readFrom(const int32_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 double* v) { |
| 93 const float* vv = reinterpret_cast<const float*>(v); |
| 94 storage[0] = vv[0]; |
| 95 storage[1] = vv[1]; |
| 96 storage[2] = vv[2]; |
| 97 storage[3] = vv[3]; |
| 98 return *this; |
| 99 } |
| 92 simd128_value_t& readFrom(const simd128_value_t* v) { | 100 simd128_value_t& readFrom(const simd128_value_t* v) { |
| 93 *this = *v; | 101 *this = *v; |
| 94 return *this; | 102 return *this; |
| 95 } | 103 } |
| 96 void writeTo(float* v) { | 104 void writeTo(float* v) { |
| 97 v[0] = storage[0]; | 105 v[0] = storage[0]; |
| 98 v[1] = storage[1]; | 106 v[1] = storage[1]; |
| 99 v[2] = storage[2]; | 107 v[2] = storage[2]; |
| 100 v[3] = storage[3]; | 108 v[3] = storage[3]; |
| 101 } | 109 } |
| 102 void writeTo(int32_t* v) { | 110 void writeTo(int32_t* v) { |
| 103 float* vv = reinterpret_cast<float*>(v); | 111 float* vv = reinterpret_cast<float*>(v); |
| 104 vv[0] = storage[0]; | 112 vv[0] = storage[0]; |
| 105 vv[1] = storage[1]; | 113 vv[1] = storage[1]; |
| 106 vv[2] = storage[2]; | 114 vv[2] = storage[2]; |
| 107 vv[3] = storage[3]; | 115 vv[3] = storage[3]; |
| 108 } | 116 } |
| 117 void writeTo(double* v) { |
| 118 float* vv = reinterpret_cast<float*>(v); |
| 119 vv[0] = storage[0]; |
| 120 vv[1] = storage[1]; |
| 121 vv[2] = storage[2]; |
| 122 vv[3] = storage[3]; |
| 123 } |
| 109 void writeTo(simd128_value_t* v) { | 124 void writeTo(simd128_value_t* v) { |
| 110 *v = *this; | 125 *v = *this; |
| 111 } | 126 } |
| 112 }; | 127 }; |
| 113 | 128 |
| 114 // Processor architecture detection. For more info on what's defined, see: | 129 // Processor architecture detection. For more info on what's defined, see: |
| 115 // http://msdn.microsoft.com/en-us/library/b0084kay.aspx | 130 // http://msdn.microsoft.com/en-us/library/b0084kay.aspx |
| 116 // http://www.agner.org/optimize/calling_conventions.pdf | 131 // http://www.agner.org/optimize/calling_conventions.pdf |
| 117 // or with gcc, run: "echo | gcc -E -dM -" | 132 // or with gcc, run: "echo | gcc -E -dM -" |
| 118 #if defined(_M_X64) || defined(__x86_64__) | 133 #if defined(_M_X64) || defined(__x86_64__) |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 // N.B.: As the GCC manual states, "[s]ince non-static C++ methods | 504 // N.B.: As the GCC manual states, "[s]ince non-static C++ methods |
| 490 // have an implicit 'this' argument, the arguments of such methods | 505 // have an implicit 'this' argument, the arguments of such methods |
| 491 // should be counted from two, not one." | 506 // should be counted from two, not one." |
| 492 #define PRINTF_ATTRIBUTE(string_index, first_to_check) \ | 507 #define PRINTF_ATTRIBUTE(string_index, first_to_check) \ |
| 493 __attribute__((__format__(__printf__, string_index, first_to_check))) | 508 __attribute__((__format__(__printf__, string_index, first_to_check))) |
| 494 #else | 509 #else |
| 495 #define PRINTF_ATTRIBUTE(string_index, first_to_check) | 510 #define PRINTF_ATTRIBUTE(string_index, first_to_check) |
| 496 #endif | 511 #endif |
| 497 | 512 |
| 498 #endif // PLATFORM_GLOBALS_H_ | 513 #endif // PLATFORM_GLOBALS_H_ |
| OLD | NEW |