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

Function do_sdr

include/recomp.h:243–262  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

241}
242
243static inline void do_sdr(uint8_t* rdram, gpr offset, gpr reg, gpr val) {
244 // Calculate the overall address
245 gpr address = (offset + reg);
246
247 // Get the initial value of the aligned dword
248 gpr dword_address = address & ~0x7;
249 uint64_t initial_value = load_doubleword(rdram, 0, dword_address);
250
251 // Mask the initial value and shift the input value appropriately
252 gpr misalignment = address & 0x7;
253 uint64_t masked_initial_value = initial_value & ~(0xFFFFFFFFFFFFFFFFu << (56 - misalignment * 8));
254 uint64_t shifted_input_value = val << (56 - misalignment * 8);
255
256 uint64_t ret = masked_initial_value | shifted_input_value;
257 uint32_t lo = (uint32_t)ret;
258 uint32_t hi = (uint32_t)(ret >> 32);
259
260 MEM_W(0, dword_address + 4) = lo;
261 MEM_W(0, dword_address + 0) = hi;
262}
263
264static inline uint32_t get_cop1_cs() {
265 uint32_t rounding_mode = 0;

Callers

nothing calls this directly

Calls 1

load_doublewordFunction · 0.85

Tested by

no test coverage detected