1

I'm getting back to my previous topic, but with nothing more than a few thoughts.

I want to store a 32-bit integer in a matrix in assembler in x64. Let's say I have:

int** matrix = ...;
matrix[x][y] = 0;

Normally I'd simply calculate a position to which I would like to save by doing:

mov rax, [rdi + rsi * 8]
mov [rax + rdx * 4], rcx

My question is: how can I align rcx to save only 4-bytes? Or maybe I do save 4-bytes only and there is no chance to overwrite some other integer next to the one to overwrite?

Alexey Frunze
  • 61,140
  • 12
  • 83
  • 180
user767849
  • 105
  • 2
  • 11

1 Answers1

3

Use ecx instead of rcx.

That's all.

Alexey Frunze
  • 61,140
  • 12
  • 83
  • 180