I was wondering how I would calculate the machine encoding of a jump instruction.
Let's say I have
j foo
at address 0x00400000
Now, what if foo is at adress 0x0040002c. How would I then find the machine encoding of the jump instruction?
[0x00400000] j foo
...
[0x0040002c] foo:
Found some guide on Youtube saying it would be something like
((400000+4) - 40002c)/4
But jump has the op-code 2, which I don't get with that calculation.
Thank you