forked from ArchC/mips
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodifiers
More file actions
43 lines (29 loc) · 702 Bytes
/
modifiers
File metadata and controls
43 lines (29 loc) · 702 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
ac_modifier_encode(carry)
{
reloc->Type_I.imm = (reloc->input + 0x00008000) >> 16;
// Same as above (simpler)
// reloc->output = (reloc->input + 0x00008000) >> 16;
}
ac_modifier_decode(carry)
{
}
ac_modifier_encode(align)
{
reloc->Type_J.addr = reloc->input >> 2;
// Simpler and same as above
// reloc->output = reloc->input >> 2;
}
ac_modifier_decode(align)
{
reloc->output = reloc->input << 2;
}
ac_modifier_encode(pcrel)
{
reloc->Type_I.imm = (reloc->input - (reloc->address + 4)) >> 2;
// Simpler version of the above
// reloc->output = (reloc->input - (reloc->address + 4)) >> 2;
}
ac_modifier_decode(pcrel)
{
reloc->output = (reloc->input << 2) + reloc->address + 4;
}