Avi Kivity wrote: > Anthony Liguori wrote: > >>> #define s_ld_u64(phys, field, type) \ >>> ldq_phys(phys + offsetof(field, type)) >>> >>> >>> And now we don't need individual accessors, or to encode the offsets >>> as magic numbers. >>> >> It's a nice thought but it doesn't work out in practice because most >> of these accessor functions are accessing array elements. However, I >> thought about using offsetof() to eliminate the magic constants and I >> don't think that's a bad idea. In the very least, it makes the code >> more readable. It'll be part of the next series. >> >> > > offsetof() should work for array members (i.e. offsetof(struct s, a[8])). >
You're right. That's pretty sweet. Regards, Anthony Liguori ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace _______________________________________________ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel