Lodestone.Common
Loading...
Searching...
No Matches
Indexing.h File Reference
Include dependency graph for Indexing.h:

Go to the source code of this file.

Namespaces

namespace  lodestone
namespace  lodestone::common

Macros

#define INDEX_ZYX(x, y, z, w, h)
#define INDEX_YZX(x, y, z, w, d)
#define INDEX_XZY(x, y, z, h, d)
#define INDEX_YX(x, y, w)
#define INDEX_XY(x, y, h)
#define GET_NIBBLE(ary, idx)
#define SET_NIBBLE(ary, idx, val)

Macro Definition Documentation

◆ GET_NIBBLE

#define GET_NIBBLE ( ary,
idx )
Value:
(idx % 2 ? /* if odd */ ary[idx / 2] & 0xf0 >> 4 \
: /* if even */ ary[idx / 2] & 0x0f)
18#define GET_NIBBLE(ary, idx) \
19 (idx % 2 ? /* if odd */ ary[idx / 2] & 0xf0 >> 4 \
20 : /* if even */ ary[idx / 2] & 0x0f)

◆ INDEX_XY

#define INDEX_XY ( x,
y,
h )
Value:
x *h + y

◆ INDEX_XZY

#define INDEX_XZY ( x,
y,
z,
h,
d )
Value:
(x * d + z) * h + y

◆ INDEX_YX

#define INDEX_YX ( x,
y,
w )
Value:
y *w + x

◆ INDEX_YZX

#define INDEX_YZX ( x,
y,
z,
w,
d )
Value:
(y * d + z) * w + x

◆ INDEX_ZYX

#define INDEX_ZYX ( x,
y,
z,
w,
h )
Value:
(z * h * x) + (y * x) + x

◆ SET_NIBBLE

#define SET_NIBBLE ( ary,
idx,
val )
Value:
(idx % 2 ? ary[idx / 2] = (ary[idx / 2] & 0x0f) | ((val & 0x0f) << 4) \
: ary[idx / 2] = (ary[idx / 2] & 0xf0) | (val & 0x0f))
21#define SET_NIBBLE(ary, idx, val) \
22 (idx % 2 ? ary[idx / 2] = (ary[idx / 2] & 0x0f) | ((val & 0x0f) << 4) \
23 : ary[idx / 2] = (ary[idx / 2] & 0xf0) | (val & 0x0f))