PageRenderTime 29ms CodeModel.GetById 0ms RepoModel.GetById 0ms 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
Possible License(s): LGPL-2.1
  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. #ifndef LL_SIMD_MATH_H
  27. #define LL_SIMD_MATH_H
  28. #ifndef LLMATH_H
  29. #error "Please include llmath.h before this file."
  30. #endif
  31. #if ( ( LL_DARWIN || LL_LINUX ) && !(__SSE2__) ) || ( LL_WINDOWS && ( _M_IX86_FP < 2 ) )
  32. #error SSE2 not enabled. LLVector4a and related class will not compile.
  33. #endif
  34. #if !LL_WINDOWS
  35. #include <stdint.h>
  36. #endif
  37. template <typename T> T* LL_NEXT_ALIGNED_ADDRESS(T* address)
  38. {
  39. return reinterpret_cast<T*>(
  40. (reinterpret_cast<uintptr_t>(address) + 0xF) & ~0xF);
  41. }
  42. template <typename T> T* LL_NEXT_ALIGNED_ADDRESS_64(T* address)
  43. {
  44. return reinterpret_cast<T*>(
  45. (reinterpret_cast<uintptr_t>(address) + 0x3F) & ~0x3F);
  46. }
  47. #if LL_LINUX || LL_DARWIN
  48. #define LL_ALIGN_PREFIX(x)
  49. #define LL_ALIGN_POSTFIX(x) __attribute__((aligned(x)))
  50. #elif LL_WINDOWS
  51. #define LL_ALIGN_PREFIX(x) __declspec(align(x))
  52. #define LL_ALIGN_POSTFIX(x)
  53. #else
  54. #error "LL_ALIGN_PREFIX and LL_ALIGN_POSTFIX undefined"
  55. #endif
  56. #define LL_ALIGN_16(var) LL_ALIGN_PREFIX(16) var LL_ALIGN_POSTFIX(16)
  57. #include <xmmintrin.h>
  58. #include <emmintrin.h>
  59. #include "llsimdtypes.h"
  60. #include "llsimdtypes.inl"
  61. class LLMatrix3a;
  62. class LLRotation;
  63. class LLMatrix3;
  64. #include "llquaternion.h"
  65. #include "llvector4logical.h"
  66. #include "llvector4a.h"
  67. #include "llmatrix3a.h"
  68. #include "llquaternion2.h"
  69. #include "llvector4a.inl"
  70. #include "llmatrix3a.inl"
  71. #include "llquaternion2.inl"
  72. #endif //LL_SIMD_MATH_H