Files
dusklight/src/dusk/extras.cpp
T
Lurs 3b742025db Fix MSVC compiler and linker errors
- Fix struct/class forward declaration mismatches (JAIAudience, JASTrack) causing different MSVC mangled names and unresolved symbols
- Add jsystem_stubs.cpp with stubs for JASHeap, JASVoiceBank, J3DShapeTable, JAUSection, JHICommBuf, HIO/HIO2, JOR
2026-02-13 23:28:47 +01:00

28 lines
630 B
C++

// C++ Mangled version of extras.c
#include <cstring>
#include <cstdint>
#ifdef _MSC_VER
#include <intrin.h>
#endif
void *__memcpy(void* dest, void const* src, int n) {
return memcpy(dest, src, n);
}
void __dcbz(void* addr, int offset) {
// Gekko cache lines are 32 bytes.
// dcbz usually requires addr to be 32-byte aligned.
memset((char*)addr + offset, 0, 32);
}
int __cntlzw(unsigned int val) {
if (val == 0) return 32; // PowerPC returns 32 if the input is 0
#ifdef _MSC_VER
unsigned long idx;
_BitScanReverse(&idx, val);
return 31 - (int)idx;
#else
return __builtin_clz(val);
#endif
}