MCPcopy Create free account
hub / github.com/akyoto/q / LoadAddress

Function LoadAddress

src/arm/LoadAddress.go:7–15  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
7func 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}

Callers 3

CompileMethod · 0.92
TestNotEncodableFunction · 0.92
TestLoadAddressFunction · 0.92

Calls

no outgoing calls

Tested by 2

TestNotEncodableFunction · 0.74
TestLoadAddressFunction · 0.74