mirror of
https://github.com/zeldaret/tww.git
synced 2026-10-10 05:51:42 -04:00
92e7ebe1f7
* add COMPOUND_LITERAL macro for non-standard struct initializer casts * fix f_pc_profile_lst for other compilers * std::__tag_va_List compiler compatibility * JStudio fix * fix return * don't use NULL for non-pointer variables
42 lines
773 B
C++
42 lines
773 B
C++
#ifndef JSUPPORT_H
|
|
#define JSUPPORT_H
|
|
|
|
template <typename T>
|
|
T* JSUConvertOffsetToPtr(const void* ptr, u32 offset) {
|
|
if (offset == 0) {
|
|
return NULL;
|
|
} else {
|
|
return (T*)((s32)ptr + offset);
|
|
}
|
|
}
|
|
|
|
template <typename T>
|
|
T* JSUConvertOffsetToPtr(const void* ptr, const void* offset) {
|
|
if (offset == NULL) {
|
|
return NULL;
|
|
} else {
|
|
return (T*)((s32)ptr + (s32)offset);
|
|
}
|
|
}
|
|
|
|
inline u8 JSULoNibble(u8 param_0) { return param_0 & 0x0f; }
|
|
inline u8 JSUHiNibble(u8 param_0) {return (param_0 & 0xff) >> 4; }
|
|
|
|
inline u8 JSULoByte(u16 in) {
|
|
return in & 0xff;
|
|
}
|
|
|
|
inline u8 JSUHiByte(u16 in) {
|
|
return in >> 8;
|
|
}
|
|
|
|
inline u16 JSULoHalf(u32 in) {
|
|
return in;
|
|
}
|
|
|
|
inline u16 JSUHiHalf(u32 in) {
|
|
return (in >> 16);
|
|
}
|
|
|
|
#endif
|