change everything to use a common types file

This commit is contained in:
Elijah Thomas
2023-12-24 09:59:13 -05:00
parent d8362c1004
commit e32db6f07a
213 changed files with 3516 additions and 3277 deletions
+82 -74
View File
@@ -1,95 +1,103 @@
// #ifndef RVL_SDK_OS_FAST_CAST_H
// #define RVL_SDK_OS_FAST_CAST_H
// #include "rvl/types.h"
// #ifdef __cplusplus
// extern "C" {
// #endif
#ifndef RVL_SDK_OS_FAST_CAST_H
#define RVL_SDK_OS_FAST_CAST_H
#include <common.h>
#ifdef __cplusplus
extern "C" {
#endif
// static void OSInitFastCast(void) {
// // clang-format off
// asm {
// li r3, 4
// oris r3, r3, 4
// mtspr 0x392, r3
static inline void OSInitFastCast(void) {
// clang-format off
asm {
li r3, 4
oris r3, r3, 4
mtspr 0x392, r3
// li r3, 5
// oris r3, r3, 5
// mtspr 0x393, r3
li r3, 5
oris r3, r3, 5
mtspr 0x393, r3
// li r3, 6
// oris r3, r3, 6
// mtspr 0x394, r3
li r3, 6
oris r3, r3, 6
mtspr 0x394, r3
// li r3, 7
// oris r3, r3, 7
// mtspr 0x395, r3
// }
// // clang-format on
// }
li r3, 7
oris r3, r3, 7
mtspr 0x395, r3
}
// clang-format on
}
// static f32 __OSu16tof32(register const u16* arg) {
// register f32 ret;
static inline f32 __OSu16tof32(register const u16 *arg) {
register f32 ret;
// // clang-format off
// asm {
// psq_l ret, 0(arg), 1, 3
// }
// // clang-format on
// clang-format off
asm {
psq_l ret, 0(arg), 1, 3
}
// clang-format on
// return ret;
// }
return ret;
}
// static void OSu16tof32(const u16* in, f32* out) { *out = __OSu16tof32(in); }
static inline void OSu16tof32(const u16 *in, f32 *out) {
*out = __OSu16tof32(in);
}
// static u16 __OSf32tou16(register f32 arg) {
// f32 a;
// register f32* ptr = &a;
// u16 r;
static inline u16 __OSf32tou16(register f32 arg) {
f32 a;
register f32 *ptr = &a;
u16 r;
// // clang-format off
// asm {
// psq_st arg, 0(ptr), 1, 3
// }
// // clang-format on
// clang-format off
asm {
psq_st arg, 0(ptr), 1, 3
}
// clang-format on
// r = *(u16*)ptr;
// return r;
// }
r = *(u16 *)ptr;
return r;
}
// static void OSf32tou16(const f32* in, u16* out) { *out = __OSf32tou16(*in); }
static inline void OSf32tou16(const f32 *in, u16 *out) {
*out = __OSf32tou16(*in);
}
// static f32 __OSs16tof32(register const s16* arg) {
// register f32 ret;
static inline f32 __OSs16tof32(register const s16 *arg) {
register f32 ret;
// // clang-format off
// asm {
// psq_l ret, 0(arg), 1, 5
// }
// // clang-format on
// clang-format off
asm {
psq_l ret, 0(arg), 1, 5
}
// clang-format on
// return ret;
// }
return ret;
}
// static void OSs16tof32(const s16* in, f32* out) { *out = __OSs16tof32(in); }
static inline void OSs16tof32(const s16 *in, f32 *out) {
*out = __OSs16tof32(in);
}
// static s16 __OSf32tos16(register f32 arg) {
// f32 a;
// register f32* ptr = &a;
// s16 r;
static inline s16 __OSf32tos16(register f32 arg) {
f32 a;
register f32 *ptr = &a;
s16 r;
// // clang-format off
// asm {
// psq_st arg, 0(ptr), 1, 5
// }
// // clang-format on
// clang-format off
asm {
psq_st arg, 0(ptr), 1, 5
}
// clang-format on
// r = *(s16*)ptr;
// return r;
// }
r = *(s16 *)ptr;
return r;
}
// static void OSf32tos16(const f32* in, s16* out) { *out = __OSf32tos16(*in); }
static inline void OSf32tos16(const f32 *in, s16 *out) {
*out = __OSf32tos16(*in);
}
// #ifdef __cplusplus
// }
// #endif
// #endif
#ifdef __cplusplus
}
#endif
#endif