LoadAddress calculates the address with the PC-relative offset in the range -1048576 to 1048575 and writes the result to the destination register.
(destination cpu.Register, offset int)
| 5 | // LoadAddress calculates the address with the PC-relative offset in the range -1048576 to 1048575 |
| 6 | // and writes the result to the destination register. |
| 7 | func LoadAddress(destination cpu.Register, offset int) (code uint32, encodable bool) { |
| 8 | if offset < -1048576 || offset > 1048575 { |
| 9 | return 0, false |
| 10 | } |
| 11 | |
| 12 | hi := uint32(offset>>2) & mask19 |
| 13 | lo := uint32(offset) & mask2 |
| 14 | return lo<<29 | 0b10000<<24 | hi<<5 | uint32(destination), true |
| 15 | } |
no outgoing calls