array[idx] += incr;
idx = __builtin_circindex(idx, incr, len);
}
}
Circular Buffer Increment of a Pointer
The following operation performs a circular buffer increment of a pointer.
void *__builtin_circptr(const void *ptr,
Both
and
incr
void pointers.
The operation is equivalent to:
ptr += incr;
if (ptr < base)
ptr += buflen;
else if (ptr >= (base+buflen))
ptr -= buflen;
An example of this built-in function is:
void func(int *array, int n, int incr, int len)
{
int i, idx = 0;
int *ptr = array;
// scale increment and length by size
// of item pointed to.
incr *= sizeof(*ptr);
len *= sizeof(*ptr);
for (i = 0; i < n; i++) {
}
}
VisualDSP++ 3.5 C/C++ Compiler and Library Manual
for ADSP-219x DSPs
unsigned size_t incr,
const void * base,
are specified in bytes, since the operation deals in
buflen
*ptr += incr;
ptr = __builtin_circptr(ptr, incr, array, len);
size_t buflen);
Compiler
1-105
Need help?
Do you have a question about the VISUALDSP++ 3.5 and is the answer not in the manual?
Questions and answers