I'm curious about which one of the following code
segments is executed faster. They are in an interrupt
handler, the readings and writings are done on the PCI bus.
__u32 tmp;
int i;
for (i=0;i<128;i++) {
tmp=readb(dev->dpmem+i);
if (!tmp) continue;
writeb(0,dev->dpmem+i);
some_code;
}
256 PCI bus access in the worst case, but fewer code
or
__u32 tmp;
int i,j;
char *p=&tmp;
for (i=0;i<128;i+=4) {
tmp=readl(dev->dpmem+i);
if (!tmp) continue;
writel(0, dev->dpmem+i);
for (j=0;j<4;j++)
if (*(p+j)) {
some_code;
}
}
64 PCI bus access in the worst case but more code
Thanks,
Gabor
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/