| 141 | } |
| 142 | |
| 143 | static 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 | |
| 160 | static inline void do_swl(uint8_t* rdram, gpr offset, gpr reg, gpr val) { |
| 161 | // Calculate the overall address |
nothing calls this directly
no outgoing calls
no test coverage detected