[XviD-devel] "restrict" keyword
Christoph Lampert
chl at math.uni-bonn.de
Mon Feb 24 23:00:30 CET 2003
Hi,
does MSVC++ know about "restrict"?
That's a new qualifier for pointer types in C99 which
tells the compiler that the data referenced by two pointers
do not overlap. This can be interesting for optimization,
because you know e.g. that write to an address does not change
the value of where the other pointer points to, so you don't have to read
that value again. It's also important for memcpy() stuff.
void
fcpy(float *restrict a, float *restrict b,
float *restrict aa, float *restrict bb, int n)
{
int i;
for(i = 0; i < n; i++) {
aa[i]=a[i];
bb[i]=b[i];
}
}
means these copy loops can be done "in parallel", because e.g. aa != b
gcc accepts it when --std=c99 is active.
gruel
More information about the XviD-devel
mailing list