Browse Source

math: fix 32-bit builds.

undefined
Sam Hocevar 10 years ago
parent
commit
b4120d6993
1 changed files with 6 additions and 0 deletions
  1. +6
    -0
      src/lol/math/arraynd.h

+ 6
- 0
src/lol/math/arraynd.h View File

@@ -107,11 +107,13 @@ public:
{ {
} }


#if PTRDIFF_MAX > INT_MAX
inline arraynd(vec_t<ptrdiff_t, N> sizes, element_t e = element_t()) inline arraynd(vec_t<ptrdiff_t, N> sizes, element_t e = element_t())
: m_sizes(sizes) : m_sizes(sizes)
{ {
FixSizes(e); FixSizes(e);
} }
#endif


inline arraynd(vec_t<int, N> sizes, element_t e = element_t()) inline arraynd(vec_t<int, N> sizes, element_t e = element_t())
{ {
@@ -136,6 +138,7 @@ public:
} }


/* Access elements directly using an vec_t<ptrdiff_t, N> index */ /* Access elements directly using an vec_t<ptrdiff_t, N> index */
#if PTRDIFF_MAX > INT_MAX
inline element_t const & operator[](vec_t<ptrdiff_t, N> const &pos) const inline element_t const & operator[](vec_t<ptrdiff_t, N> const &pos) const
{ {
ptrdiff_t n = pos[N - 1]; ptrdiff_t n = pos[N - 1];
@@ -149,6 +152,7 @@ public:
return const_cast<element_t &>( return const_cast<element_t &>(
const_cast<arraynd<N, T...> const&>(*this)[pos]); const_cast<arraynd<N, T...> const&>(*this)[pos]);
} }
#endif


/* Access elements directly using an ivec2, ivec3 etc. index */ /* Access elements directly using an ivec2, ivec3 etc. index */
inline element_t const & operator[](vec_t<int, N> const &pos) const inline element_t const & operator[](vec_t<int, N> const &pos) const
@@ -229,11 +233,13 @@ public:


/* Resize the array. /* Resize the array.
* FIXME: data gets scrambled; should we care? */ * FIXME: data gets scrambled; should we care? */
#if PTRDIFF_MAX > INT_MAX
inline void SetSize(vec_t<ptrdiff_t, N> sizes, element_t e = element_t()) inline void SetSize(vec_t<ptrdiff_t, N> sizes, element_t e = element_t())
{ {
m_sizes = sizes; m_sizes = sizes;
FixSizes(e); FixSizes(e);
} }
#endif


inline void SetSize(vec_t<int, N> sizes, element_t e = element_t()) inline void SetSize(vec_t<int, N> sizes, element_t e = element_t())
{ {


Loading…
Cancel
Save