diff options
| author | elijah-thomas774 <elijahthomas774@gmail.com> | 2024-06-09 21:04:42 -0400 |
|---|---|---|
| committer | elijah-thomas774 <elijahthomas774@gmail.com> | 2024-06-09 21:04:42 -0400 |
| commit | 53aa4e2efa0f5e2d662857ebdb593d33099b86bf (patch) | |
| tree | 5854ea5474683f1756355dd90cfba8d67fed0c30 /include/rvl | |
| parent | f7e702e159da9b3b27acd76c535be10677f30e94 (diff) | |
lyt_animation *ALMOST*
Diffstat (limited to 'include/rvl')
| -rw-r--r-- | include/rvl/OS/OSFastCast.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/rvl/OS/OSFastCast.h b/include/rvl/OS/OSFastCast.h index 5791018a..8db17517 100644 --- a/include/rvl/OS/OSFastCast.h +++ b/include/rvl/OS/OSFastCast.h @@ -57,11 +57,27 @@ static inline u16 __OSf32tou16(register f32 arg) { r = *(u16 *)ptr; return r; } +static inline u8 __OSf32tou8(register f32 arg) { + f32 a; + register f32 *ptr = &a; + register u8 r; + + // clang-format off + asm { + psq_st arg, 0(ptr), 1, 2 + lbz r, 0(ptr) + } + // clang-format on + return r; +} static inline void OSf32tou16(const f32 *in, u16 *out) { *out = __OSf32tou16(*in); } +static inline void OSf32tou8(const f32 *in, u8 *out) { + *out = __OSf32tou8(*in); +} static inline f32 __OSs16tof32(register const s16 *arg) { register f32 ret; |
