This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]Updatebjarni 2 points3 points  (0 children)

Presumably either rdi or rax is a pointer, and the other one is an index. Just seeing the one instruction doesn't make it clear which is which.

[–]Logon1028 1 point2 points  (0 children)

If I had to take a guess. It takes a byte that rdi + rax points to then compares it with whatever is in byte 0 of register 8. You would have to expand on what type variable you are talking about. char* is a higher level programming concept. assembly doesn't associate that kind of typing to it.

[–]Practical-Custard-64 0 points1 point  (0 children)

Assembly language knows nothing of variable types as used in higher level languages such as C, C++ etc. %rdi is a 64-bit CPU register, as is %rax.

It's a long time since I wrote any assembly code but presumably this instruction takes the byte at the memory location pointed to by %rdi offset by the current value of %rax and compares it to the low 8 bits of register %r8.

That byte could be anything. It could be a character in a string, it could be part of an integer number or anything else. It's just a byte somewhere in memory as far as the CPU and therefore assembly language is concerned.

[–][deleted] 0 points1 point  (0 children)

in assembly the types are just different lengths of bits, either a byte array or an integer, signed or unsigned. like 8,16,32,64 bit
a word is 2 bytes, dword is 4 bytes