mirror of
https://github.com/zeldaret/mm.git
synced 2026-09-07 19:10:38 -04:00
z_lib now uses SEGMENTED_TO_VIRTUAL macro
Additionally removed some TODO comments in z_scene and defining gRspSegmentPhysAddrs array size as NUM_SEGMENTS
This commit is contained in:
+3
-5
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user