MCPcopy Create free account
hub / github.com/N64Recomp/N64Recomp / do_lwr

Function do_lwr

include/recomp.h:143–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141}
142
143static inline gpr do_lwr(uint8_t* rdram, gpr initial_value, gpr offset, gpr reg) {
144 // Calculate the overall address
145 gpr address = (offset + reg);
146
147 // Load the aligned word
148 gpr word_address = address & ~0x3;
149 uint32_t loaded_value = MEM_W(0, word_address);
150
151 // Mask the existing value and shift the loaded value appropriately
152 gpr misalignment = address & 0x3;
153 gpr masked_value = initial_value & (gpr)(uint32_t)~(0xFFFFFFFFu >> (24 - misalignment * 8));
154 loaded_value >>= (24 - misalignment * 8);
155
156 // Cast to int32_t to sign extend first
157 return (gpr)(int32_t)(masked_value | loaded_value);
158}
159
160static inline void do_swl(uint8_t* rdram, gpr offset, gpr reg, gpr val) {
161 // Calculate the overall address

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected