Merge pull request #438 from s4Ys369/revert-434-patch-1
[sm64pc.git] / include / command_macros_base.h
blobe2fc760ec79882b363f7cb0e5eacd7fdaf9c752e
1 #ifndef COMMAND_MACROS_BASE_H
2 #define COMMAND_MACROS_BASE_H
4 #include "platform_info.h"
6 #if IS_BIG_ENDIAN
7 #if IS_64_BIT
8 #define CMD_BBBB(a, b, c, d) ((uintptr_t)(_SHIFTL(a, 24, 8) | _SHIFTL(b, 16, 8) | _SHIFTL(c, 8, 8) | _SHIFTL(d, 0, 8)) << 32)
9 #define CMD_BBH(a, b, c) ((uintptr_t)(_SHIFTL(a, 24, 8) | _SHIFTL(b, 16, 8) | _SHIFTL(c, 0, 16)) << 32)
10 #define CMD_HH(a, b) ((uintptr_t)(_SHIFTL(a, 16, 16) | _SHIFTL(b, 0, 16)) << 32)
11 #define CMD_W(a) ((uintptr_t)(a) << 32)
12 #else
13 #define CMD_BBBB(a, b, c, d) (_SHIFTL(a, 24, 8) | _SHIFTL(b, 16, 8) | _SHIFTL(c, 8, 8) | _SHIFTL(d, 0, 8))
14 #define CMD_BBH(a, b, c) (_SHIFTL(a, 24, 8) | _SHIFTL(b, 16, 8) | _SHIFTL(c, 0, 16))
15 #define CMD_HH(a, b) (_SHIFTL(a, 16, 16) | _SHIFTL(b, 0, 16))
16 #define CMD_W(a) (a)
17 #endif
18 #else
19 #define CMD_BBBB(a, b, c, d) (_SHIFTL(a, 0, 8) | _SHIFTL(b, 8, 8) | _SHIFTL(c, 16, 8) | _SHIFTL(d, 24, 8))
20 #define CMD_BBH(a, b, c) (_SHIFTL(a, 0, 8) | _SHIFTL(b, 8, 8) | _SHIFTL(c, 16, 16))
21 #define CMD_HH(a, b) (_SHIFTL(a, 0, 16) | _SHIFTL(b, 16, 16))
22 #define CMD_W(a) (a)
23 #endif
24 #define CMD_PTR(a) ((uintptr_t)(a))
26 #define CMD_HHHHHH(a, b, c, d, e, f) CMD_HH(a, b), CMD_HH(c, d), CMD_HH(e, f)
28 #endif