Files
tp/include/global.h
T
lepelog 5be309a186 c_cc_d (#132)
* gnd check

* more c_bg_s

* start adding static asserts for size

* Add more size checks

* c_cc

* c_cc progress

* failed implementing cCcD_*Attr

* progress

* format

* try destructor

* data

* remove unused asm

* remove inlineCross

* remove functions that didn't belong there

* naming fix

* match cCcD_SphAttr::CalcAabBox

* cCcD_Stts::ClrTg

* c_cc_s and mass fixes
2021-06-12 18:20:45 -04:00

43 lines
1.1 KiB
C

#ifndef _global_h_
#define _global_h_
#include "dolphin/types.h"
#define ARRAY_SIZE(o) (sizeof((o)) / sizeof(*(o)))
// Align X to the previous N bytes (N must be power of two)
#define ALIGN_PREV(X, N) ((X) & ~((N)-1))
// Align X to the next N bytes (N must be power of two)
#define ALIGN_NEXT(X, N) ALIGN_PREV(((X) + (N)-1), N)
#define IS_ALIGNED(X, N) (((X) & ((N)-1)) == 0)
#define IS_NOT_ALIGNED(X, N) (((X) & ((N)-1)) != 0)
#define JUT_ASSERT(...)
#define JUT_EXPECT(...)
#define ASSERT(...)
#define LOGF(FMT, ...)
#define FLAG_ON(V, F) (((V) & (F)) == 0)
#define FLOAT_LABEL(x) (*(f32*)&x)
#define DOUBLE_LABEL(x) (*(f64*)&x)
#define _SDA_BASE_(dummy) 0
#define _SDA2_BASE_(dummy) 0
#define GLUE(a, b) a##b
#define GLUE2(a, b) GLUE(a, b)
#define STATIC_ASSERT(cond) typedef char GLUE2(static_assertion_failed, __LINE__)[(cond) ? 1 : -1]
struct JUTWarn {
JUTWarn& operator<<(const char*) { return *this; }
JUTWarn& operator<<(long) { return *this; }
};
// hack to make functions that return comparisons as int match
extern int __cntlzw(unsigned int);
inline BOOL checkEqual(s32 a, s32 b) {
return (u32)__cntlzw(a - b) >> 5;
}
#endif