GTHk LIT ADD ADD #00 STR
10 comments | Expand all CWs
@andreer It's used in a routine that returns an offset to be used to find a routine in a lookup table of pointers. It's part of a project that uses cons cells. @neauoire @neauoire Hm, so if I understand correctly, this only works because the opcodes for ADD and SUB are 18 and 19. Were those values to change in a future release, most code would still work, but this piece would break. 🤔 It's interesting how "code = data" is true in both assembly and Lisp, but their takes on it are entirely different. 🙂 |
if(a > b) {
return a + b;
}
else {
return a - b;
}
It quotes the add function and transforms it to a subtraction without branching.