-
Notifications
You must be signed in to change notification settings - Fork 302
Open
Description
In site/content/chapter3/code/3.63.c
case 64:
x = x << 4 - x;
case 65:
x = x * x;
Need to be modified to
case 64:
result = (x << 4) - x;
x = result;
case 65:
x = x * x;
Because
x in %rdi, n in %rsi
....
case 64:
4005b2: 48 89 f8 mov %rdi,%rax ; result = x
4005b5: 48 c1 e0 04 shl $0x4,%rax ; result = x << 4
4005b9: 48 29 f8 sub %rdi,%rax ; result = (x << 4) - x
4005bc: 48 89 c7 mov %rax,%rdi ; x = result
case 65:
4005bf: 48 0f af ff imul %rdi,%rdi ; x = x * x
case 61/default:
4005c3: 48 8d 47 4b lea 0x4b(%rdi),%rax ; result = x + 0x4b
4005c7: c3 retq
Metadata
Metadata
Assignees
Labels
No labels