mirror of https://github.com/PrimeDecomp/prime.git
65 lines
1.2 KiB
C
65 lines
1.2 KiB
C
#ifndef _DOLPHIN_OSFASTCAST
|
|
#define _DOLPHIN_OSFASTCAST
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#define OS_GQR_F32 0x0000
|
|
#define OS_GQR_U8 0x0004
|
|
#define OS_GQR_U16 0x0005
|
|
#define OS_GQR_S8 0x0006
|
|
#define OS_GQR_S16 0x0007
|
|
|
|
#define OS_FASTCAST_U8 2
|
|
#define OS_FASTCAST_U16 3
|
|
#define OS_FASTCAST_S16 5
|
|
// clang-format off
|
|
static inline void OSInitFastCast(void) {
|
|
#ifdef __MWERKS__
|
|
asm
|
|
{
|
|
li r3, OS_GQR_U8
|
|
oris r3, r3, OS_GQR_U8
|
|
mtspr GQR2, r3
|
|
|
|
li r3, OS_GQR_U16
|
|
oris r3, r3, OS_GQR_U16
|
|
mtspr GQR3, r3
|
|
|
|
li r3, OS_GQR_S8
|
|
oris r3, r3, OS_GQR_S8
|
|
mtspr GQR4, r3
|
|
|
|
li r3, OS_GQR_S16
|
|
oris r3, r3, OS_GQR_S16
|
|
mtspr GQR5, r3
|
|
}
|
|
#else
|
|
asm volatile ("
|
|
li 3, 0x0004
|
|
oris 3, 3, 0x0004
|
|
mtspr GQR2, 3
|
|
|
|
li 3, 0x0005
|
|
oris 3, 3, 0x0005
|
|
mtspr GQR3, 3
|
|
|
|
li 3, 0x0006
|
|
oris 3, 3, 0x0006
|
|
mtspr GQR4, 3
|
|
|
|
li 3, 0x0007
|
|
oris 3, 3, 0x0007
|
|
mtspr GQR5, 3
|
|
" : : : "r3" );
|
|
#endif
|
|
}
|
|
// clang-format off
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif // _DOLPHIN_OSFASTCAST
|