-
Notifications
You must be signed in to change notification settings - Fork 40
/
vectormath.hpp
49 lines (42 loc) · 1.83 KB
/
vectormath.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// ================================================================================================
// -*- C++ -*-
// File: vectormath/vectormath.hpp
// Author: Guilherme R. Lampert
// Created on: 30/12/16
// Brief: This header exposes the Sony Vectormath library types and functions into the global scope.
// ================================================================================================
#ifndef VECTORMATH_HPP
#define VECTORMATH_HPP
#if (!defined(VECTORMATH_DEBUG) && (defined(DEBUG) || defined(_DEBUG)))
#define VECTORMATH_DEBUG 1
#endif // DEBUG || _DEBUG
// Detecting the availability of SSE at compile-time is a bit more involving with Visual Studio...
#ifdef _MSC_VER
#if (defined(__AVX__) || defined(__AVX2__) || defined(_M_AMD64) || defined(_M_X64) || (_M_IX86_FP == 1) || (_M_IX86_FP == 2))
#define VECTORMATH_CPU_HAS_SSE1_OR_BETTER 1
#else // SSE support
#define VECTORMATH_CPU_HAS_SSE1_OR_BETTER 0
#endif // SSE support
#else // !_MSC_VER
#if defined(__SSE__)
#define VECTORMATH_CPU_HAS_SSE1_OR_BETTER 1
#else // !__SSE__
#define VECTORMATH_CPU_HAS_SSE1_OR_BETTER 0
#endif // __SSE__
#endif // _MSC_VER
// Sony's library includes:
#if (VECTORMATH_CPU_HAS_SSE1_OR_BETTER && !VECTORMATH_FORCE_SCALAR_MODE)
#include "sse/vectormath.hpp"
using namespace Vectormath::SSE;
#define VECTORMATH_MODE_SCALAR 0
#define VECTORMATH_MODE_SSE 1
#else // !SSE
#include "scalar/vectormath.hpp"
using namespace Vectormath::Scalar;
#define VECTORMATH_MODE_SCALAR 1
#define VECTORMATH_MODE_SSE 0
#endif // Vectormath mode selection
#include "vec2d.hpp" // - Extended 2D vector and point classes; not aligned and always in scalar floats mode.
#include "common.hpp" // - Miscellaneous helper functions.
using namespace Vectormath;
#endif // VECTORMATH_HPP