3 ms·
Yes, I think it was designed in particular for determining addresses of fields within structures and variables on the stack, for example if you had: struct
by efaref 10y ago
Yes, I think it was designed in particular for determining addresses of fields within structures and variables on the stack, for example if you had:
struct foo
{
int field1;
int field2[10];
}
Then an access like:
fooptr->field2[index]
Would compile to:
fooptr + sizeof(int) * index + offsetof(struct foo, field2)
Which is:
lea $4(fooptr,index,4)