1 #ifndef GfxTL__ARRAYARITHMETIC_HEADER__
2 #define GfxTL__ARRAYARITHMETIC_HEADER__
9 template<
unsigned int DimT >
15 template<
class ExtentT >
21 template<
class ExtentT >
25 for (
unsigned int i = DimT - 1; i != 0; --i)
27 m_fac[i - 1] = m_fac[i] * ext[i];
30 for (
unsigned int i = 0; i < DimT - 1; ++i)
32 m_transFac[i + 1] = m_transFac[i] * ext[i];
36 template<
class SubscriptT >
39 size_t idx =
sub[0] * m_fac[0];
40 for (
unsigned int i = 1; i < DimT; ++i)
42 idx +=
sub[i] * m_fac[i];
47 template<
class SubscriptT >
50 size_t idx =
sub[0] * m_transFac[0];
51 for (
unsigned int i = 1; i < DimT; ++i)
53 idx +=
sub[i] * m_transFac[i];
58 template<
class SubscriptT >
61 intptr_t off =
sub[0] * m_fac[0];
62 for (
unsigned int i = 1; i < DimT; ++i)
64 off +=
sub[i] * m_fac[i];
69 template<
class SubscriptT >
72 for (
unsigned int i = 0; i < DimT; ++i)
74 (*sub)[i] = idx / m_fac[i];
79 template<
class SubscriptT >
82 for (
unsigned int i = DimT - 1; i != -1; --i)
84 (*sub)[i] = tidx / m_transFac[i];
85 tidx %= m_transFac[i];
93 for (
unsigned int i = 0; i < DimT; ++i)
95 size_t j = idx / m_fac[i];
97 tidx += j * m_transFac[i];
106 for (
unsigned int i = DimT - 1; i != -1; --i)
108 size_t j = tidx / m_transFac[i];
109 tidx %= m_transFac[i];
117 size_t m_transFac[DimT];