What does this line of assembly do?

I have this line of assembly:

cmpb   $0x0,(%rax,%rcx,1)

Now, according to the references out there, cmpb does an immediate compare of two bytes. So it compares 0 with (%rax,%rcx,1). Can somebody explain what this second argument is / does?

Thanks!

Answers


This is the AT&T syntax for

cmp BYTE PTR [rax+rcx*1], 0

So it computes the address using rax + rcx, dereference it to obtain a byte, and then compare it with the number 0.


The general syntax for this type of memory operand is:

disp(base,offset,mult)

which gives you the address:

base + disp + offset*mult

So in your case (disp is 0), cmpb compares 0 and the value stored at:

%rax + (%rcx * 1)

Need Your Help

how to optimise mysql queries

php mysql database query-optimization

I get notification from my web hosting company to optimize MySQL queries in my website.They told me that the running MySql queries for more than 15 seconds is not allowed in shared hosting whereas ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.