Skip to content

Commit

Permalink
Replace std::array with raw arrays in matrices
Browse files Browse the repository at this point in the history
  • Loading branch information
mogemimi committed Jan 28, 2018
1 parent b35d3dd commit d2a55a1
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 22 deletions.
3 changes: 1 addition & 2 deletions include/Pomdog/Math/detail/FloatingPointMatrix2x2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <cstddef>
#include <cstdint>
#include <type_traits>
#include <array>

namespace Pomdog {
namespace Detail {
Expand All @@ -18,7 +17,7 @@ class POMDOG_EXPORT FloatingPointMatrix2x2 {
static_assert(std::is_floating_point<T>::value, "T is floating point.");
typedef T value_type;

std::array<std::array<T, 2>, 2> m;
T m[2][2];

private:
static constexpr std::size_t RowSize = 2;
Expand Down
3 changes: 1 addition & 2 deletions include/Pomdog/Math/detail/FloatingPointMatrix3x2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <cstddef>
#include <cstdint>
#include <type_traits>
#include <array>

namespace Pomdog {
namespace Detail {
Expand All @@ -18,7 +17,7 @@ class POMDOG_EXPORT FloatingPointMatrix3x2 {
static_assert(std::is_floating_point<T>::value, "T is floating point.");
typedef T value_type;

std::array<std::array<T, 2>, 3> m;
T m[3][2];

private:
static constexpr std::size_t RowSize = 3;
Expand Down
3 changes: 1 addition & 2 deletions include/Pomdog/Math/detail/FloatingPointMatrix3x3.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <cstddef>
#include <cstdint>
#include <type_traits>
#include <array>

namespace Pomdog {
namespace Detail {
Expand All @@ -18,7 +17,7 @@ class POMDOG_EXPORT FloatingPointMatrix3x3 {
static_assert(std::is_floating_point<T>::value, "T is floating point.");
typedef T value_type;

std::array<std::array<T, 3>, 3> m;
T m[3][3];

private:
static constexpr std::size_t RowSize = 3;
Expand Down
9 changes: 1 addition & 8 deletions include/Pomdog/Math/detail/FloatingPointMatrix4x4.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <cstddef>
#include <cstdint>
#include <type_traits>
#include <array>

namespace Pomdog {
namespace Detail {
Expand All @@ -18,13 +17,7 @@ class POMDOG_EXPORT FloatingPointMatrix4x4 {
static_assert(std::is_floating_point<T>::value, "T is floating point.");
typedef T value_type;

//union {
// std::array<std::array<T, 4>, 4> m;
//#if defined __i386__ || defined __x86_64__
// std::array<__m128, 4>
//#endif
//};
std::array<std::array<T, 4>, 4> m;
T m[4][4];

private:
static constexpr std::size_t RowSize = 4;
Expand Down
4 changes: 2 additions & 2 deletions src/Math/detail/FloatingPointMatrix2x2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,14 @@ template <typename T>
const T* FloatingPointMatrix2x2<T>::Data() const noexcept
{
static_assert(std::is_floating_point<T>::value, "T is floating point number");
return m[0].data();
return m[0];
}

template <typename T>
T* FloatingPointMatrix2x2<T>::Data() noexcept
{
static_assert(std::is_floating_point<T>::value, "T is floating point number");
return m[0].data();
return m[0];
}

template <typename T>
Expand Down
4 changes: 2 additions & 2 deletions src/Math/detail/FloatingPointMatrix3x2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,14 +381,14 @@ template <typename T>
const T* FloatingPointMatrix3x2<T>::Data() const noexcept
{
static_assert(std::is_floating_point<T>::value, "T is floating point number");
return m[0].data();
return m[0];
}

template <typename T>
T* FloatingPointMatrix3x2<T>::Data() noexcept
{
static_assert(std::is_floating_point<T>::value, "T is floating point number");
return m[0].data();
return m[0];
}

template <typename T>
Expand Down
4 changes: 2 additions & 2 deletions src/Math/detail/FloatingPointMatrix3x3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -626,14 +626,14 @@ template <typename T>
const T* FloatingPointMatrix3x3<T>::Data() const noexcept
{
static_assert(std::is_floating_point<T>::value, "T is floating point number");
return m[0].data();
return m[0];
}

template <typename T>
T* FloatingPointMatrix3x3<T>::Data() noexcept
{
static_assert(std::is_floating_point<T>::value, "T is floating point number");
return m[0].data();
return m[0];
}

template <typename T>
Expand Down
4 changes: 2 additions & 2 deletions src/Math/detail/FloatingPointMatrix4x4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1231,14 +1231,14 @@ template <typename T>
const T* FloatingPointMatrix4x4<T>::Data() const noexcept
{
static_assert(std::is_floating_point<T>::value, "T is floating point number");
return m[0].data();
return m[0];
}

template <typename T>
T* FloatingPointMatrix4x4<T>::Data() noexcept
{
static_assert(std::is_floating_point<T>::value, "T is floating point number");
return m[0].data();
return m[0];
}

template <typename T>
Expand Down

0 comments on commit d2a55a1

Please sign in to comment.