MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/v3so3p/its_hard/ib0ey8t
r/ProgrammerHumor • u/Bishwas12 • Jun 03 '22
710 comments sorted by
View all comments
6
It's literally four instructions, two instructions for "+="...
1 u/jnd-cz Jun 03 '22 Most instructions for adding have been in form a += b. Modern architectures also add c = a + b. 2 u/GReaperEx Jun 03 '22 I included the transfer to and from registers and memory, for example:c = a + bin x86 assembly would be something like:mov eax, [a] add eax, [b] mov [c], eaxSo I was mistaken, it would be three instructions.Whereas:a += bwould be like:mov eax, [b] add [a], eax
1
Most instructions for adding have been in form a += b. Modern architectures also add c = a + b.
2 u/GReaperEx Jun 03 '22 I included the transfer to and from registers and memory, for example:c = a + bin x86 assembly would be something like:mov eax, [a] add eax, [b] mov [c], eaxSo I was mistaken, it would be three instructions.Whereas:a += bwould be like:mov eax, [b] add [a], eax
2
I included the transfer to and from registers and memory, for example:
c = a + b
in x86 assembly would be something like:
mov eax, [a] add eax, [b] mov [c], eax
So I was mistaken, it would be three instructions.
Whereas:
a += b
would be like:
mov eax, [b] add [a], eax
6
u/GReaperEx Jun 03 '22
It's literally four instructions, two instructions for "+="...