summaryrefslogtreecommitdiff
path: root/src/code/z_lib.c
diff options
context:
space:
mode:
authorKenix3 <kenixwhisperwind@gmail.com>2020-06-04 23:25:57 -0400
committerKenix3 <kenixwhisperwind@gmail.com>2020-06-04 23:25:57 -0400
commitcb8b9a20206782d171916a32adf5dd5409825350 (patch)
treea140cbb621f59e8ba4e5d4d5f5d0ad20d237ea68 /src/code/z_lib.c
parent5c97d35841f99bbb23dffa797475f16ec1e3403b (diff)
z_lib now uses SEGMENTED_TO_VIRTUAL macro
Additionally removed some TODO comments in z_scene and defining gRspSegmentPhysAddrs array size as NUM_SEGMENTS
Diffstat (limited to 'src/code/z_lib.c')
-rw-r--r--src/code/z_lib.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/code/z_lib.c b/src/code/z_lib.c
index 101af60d9..a6e9c4e76 100644
--- a/src/code/z_lib.c
+++ b/src/code/z_lib.c
@@ -607,18 +607,16 @@ f32 Lib_PushAwayVec3f(Vec3f* start, Vec3f* pusher, f32 distanceToApproach) {
void Lib_Nop801004FC(void) {}
void* Lib_PtrSegToVirt(void* ptr) {
- // UB to cast the pointer to u32
- return (void*)PHYSICAL_TO_VIRTUAL((u32)gRspSegmentPhysAddrs[((u32)ptr << 4) >> 28] + ((u32)ptr & 0xFFFFFF));
+ return SEGMENTED_TO_VIRTUAL(ptr);
}
void* Lib_PtrSegToVirtNull(void* ptr) {
- // UB to cast the pointer to u32 in order to bitshift.
+ // UB: to cast the pointer to u32 in order to bitshift.
if (((u32)ptr >> 28) == 0) {
return ptr;
}
- // UB to cast the pointer to u32
- return (void*)PHYSICAL_TO_VIRTUAL((u32)gRspSegmentPhysAddrs[((u32)ptr << 4) >> 28] + ((u32)ptr & 0xFFFFFF));
+ return SEGMENTED_TO_VIRTUAL(ptr);
}
void* Lib_PtrSegToK0(void* ptr) {