diff options
Diffstat (limited to 'arm9/source/bang.h')
-rw-r--r-- | arm9/source/bang.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/arm9/source/bang.h b/arm9/source/bang.h new file mode 100644 index 0000000..1e13f9f --- /dev/null +++ b/arm9/source/bang.h @@ -0,0 +1,27 @@ +#ifndef BANG_H_ + #define BANG_H_ + + #define SET_HIGH(v,high) v = high << 8 | (v & 0x00ff) + #define SET_LOW(v,low) v = (v & 0xff00) | low + #define HIGH(v) (u8)((v) >> 8) + #define LOW(v) (u8)((v) ) + + #define H_HIGH(v) (u8)((v) >> 24) + #define H_LOW(v) (u8)((v) >> 16) + #define L_HIGH(v) (u8)((v) >> 8) + #define L_LOW(v) (u8)((v) ) + + #define LEFT(x) ((x) >> 4) + #define RIGHT(x) ((x) & 0xf) + + #define SHF(x,y) (x >> RIGHT(y) << LEFT(y)) + #define TAL(x) __builtin_popcount(x) + + #define TEST(x,m) ((x & m) == m) + #define BOOL(v) ((u8)-(v)) + #define DOUBLE(h,l) ((u16)(h) << 8 | (u16)(l)) + + u8 rev(u8 x); + u8 shc(u8 x, u8 y); + u16 shcd(u16 x, u8 y); +#endif |