Add XE_ARCH_*

This commit is contained in:
Dr. Chat 2017-05-07 18:25:06 -05:00
parent 99078fffbd
commit e26aa6c189
2 changed files with 15 additions and 3 deletions

View File

@ -10,8 +10,6 @@
#ifndef XENIA_BASE_MATH_H_
#define XENIA_BASE_MATH_H_
#include <xmmintrin.h>
#include <algorithm>
#include <cstdint>
#include <cstring>
@ -19,6 +17,10 @@
#include "xenia/base/platform.h"
#if XE_ARCH_AMD64
#include <xmmintrin.h>
#endif
namespace xe {
template <typename T, size_t N>
@ -255,6 +257,7 @@ T clamp(T value, T min_value, T max_value) {
return t > max_value ? max_value : t;
}
#if XE_ARCH_AMD64
// Utilities for SSE values.
template <int N>
float m128_f32(const __m128& v) {
@ -294,6 +297,7 @@ template <int N>
int64_t m128_i64(const __m128& v) {
return m128_i64<N>(_mm_castps_pd(v));
}
#endif
uint16_t float_to_half(float value);
float half_to_float(uint16_t value);

View File

@ -47,6 +47,14 @@
#define XE_COMPILER_UNKNOWN 1
#endif
#if defined(_M_AMD64) || defined(__amd64__)
#define XE_ARCH_AMD64 1
#elif defined(_M_IX86)
#error "Xenia is not supported on 32-bit platforms."
#elif defined(_M_PPC) || defined(__powerpc__)
#define XE_ARCH_PPC 1
#endif
#if XE_PLATFORM_WIN32
#define strdup _strdup
#define strcasecmp _stricmp
@ -57,7 +65,7 @@
#if XE_PLATFORM_WIN32
#include <intrin.h>
#else
#elif XE_ARCH_AMD64
#include <x86intrin.h>
#endif // XE_PLATFORM_WIN32