PageRenderTime 18ms CodeModel.GetById 12ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/llmath/llsimdmath.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 93 lines | 47 code | 21 blank | 25 comment | 5 complexity | c045d281c5b048ab050b61e3787b9aa0 MD5 | raw file
 1/** 
 2 * @file llsimdmath.h
 3 * @brief Common header for SIMD-based math library (llvector4a, llmatrix3a, etc.)
 4 *
 5 * $LicenseInfo:firstyear=2010&license=viewerlgpl$
 6 * Second Life Viewer Source Code
 7 * Copyright (C) 2010, Linden Research, Inc.
 8 * 
 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation;
12 * version 2.1 of the License only.
13 * 
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 * Lesser General Public License for more details.
18 * 
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22 * 
23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
24 * $/LicenseInfo$
25 */
26
27#ifndef	LL_SIMD_MATH_H
28#define	LL_SIMD_MATH_H
29
30#ifndef LLMATH_H
31#error "Please include llmath.h before this file."
32#endif
33
34#if ( ( LL_DARWIN || LL_LINUX ) && !(__SSE2__) ) || ( LL_WINDOWS && ( _M_IX86_FP < 2 ) )
35#error SSE2 not enabled. LLVector4a and related class will not compile.
36#endif
37
38#if !LL_WINDOWS
39#include <stdint.h>
40#endif
41
42template <typename T> T* LL_NEXT_ALIGNED_ADDRESS(T* address) 
43{ 
44	return reinterpret_cast<T*>(
45		(reinterpret_cast<uintptr_t>(address) + 0xF) & ~0xF);
46}
47
48template <typename T> T* LL_NEXT_ALIGNED_ADDRESS_64(T* address) 
49{ 
50	return reinterpret_cast<T*>(
51		(reinterpret_cast<uintptr_t>(address) + 0x3F) & ~0x3F);
52}
53
54#if LL_LINUX || LL_DARWIN
55
56#define			LL_ALIGN_PREFIX(x)
57#define			LL_ALIGN_POSTFIX(x)		__attribute__((aligned(x)))
58
59#elif LL_WINDOWS
60
61#define			LL_ALIGN_PREFIX(x)		__declspec(align(x))
62#define			LL_ALIGN_POSTFIX(x)
63
64#else
65#error "LL_ALIGN_PREFIX and LL_ALIGN_POSTFIX undefined"
66#endif
67
68#define LL_ALIGN_16(var) LL_ALIGN_PREFIX(16) var LL_ALIGN_POSTFIX(16)
69
70
71
72#include <xmmintrin.h>
73#include <emmintrin.h>
74
75#include "llsimdtypes.h"
76#include "llsimdtypes.inl"
77
78class LLMatrix3a;
79class LLRotation;
80class LLMatrix3;
81
82#include "llquaternion.h"
83
84#include "llvector4logical.h"
85#include "llvector4a.h"
86#include "llmatrix3a.h"
87#include "llquaternion2.h"
88#include "llvector4a.inl"
89#include "llmatrix3a.inl"
90#include "llquaternion2.inl"
91
92
93#endif //LL_SIMD_MATH_H