| 124 | load_doubleword(rdram, offset, reg) |
| 125 | |
| 126 | static inline gpr do_lwl(uint8_t* rdram, gpr initial_value, gpr offset, gpr reg) { |
| 127 | // Calculate the overall address |
| 128 | gpr address = (offset + reg); |
| 129 | |
| 130 | // Load the aligned word |
| 131 | gpr word_address = address & ~0x3; |
| 132 | uint32_t loaded_value = MEM_W(0, word_address); |
| 133 | |
| 134 | // Mask the existing value and shift the loaded value appropriately |
| 135 | gpr misalignment = address & 0x3; |
| 136 | gpr masked_value = initial_value & (gpr)(uint32_t)~(0xFFFFFFFFu << (misalignment * 8)); |
| 137 | loaded_value <<= (misalignment * 8); |
| 138 | |
| 139 | // Cast to int32_t to sign extend first |
| 140 | return (gpr)(int32_t)(masked_value | loaded_value); |
| 141 | } |
| 142 | |
| 143 | static inline gpr do_lwr(uint8_t* rdram, gpr initial_value, gpr offset, gpr reg) { |
| 144 | // Calculate the overall address |
nothing calls this directly
no outgoing calls
no test coverage detected