Post Go back to editing

Looking for documentation on circindex()

Category: Software
Product Number: Blackfin
Software Version: Crosscore Embedded Studio 2.8.0

I've seen someone else ask this back in 2012. 11 years later and apparently there is still no documentation update. I need to understand what circindex() does. I see that it is a built-in function but I don't see any source code in the libarry source directories, so I'm going to assume this is "built in" by the compiler?

builtins.h shows the following:

static ptrdiff_t circindex(ptrdiff_t __a, ptrdiff_t __b, size_t __c) {
ptrdiff_t __rval;
__rval = __builtin_circindex(__a, __b, __c);
return __rval;

If someone could explain what this does in detail, I would appreciate it.

  • Hi,

    From your details we understood that, you are using CCES.

    Please refer the section "Circular Buffer Built-In Functions" on page no:2–172 in the below linked "Compiler and Library Manual for Blackfin Processors" to know more details on circindex function. The compiler will use the hardware circular buffer logic when those functions are called.

    Please note that the “-force-circbuf” compiler switch option can also be used to force the compiler to use the circular buffer hardware. More information on this switch can be found on page 2-27 in the above linked manual.

    Also, we suspect that you are referring the below thread and reporting that apparently there is still no documentation update. Please confirm.

    If so, Please note that the documents has been updated.(i.e, we added statement to the document that "increment should not exceed the buffer length" which was mention on the thread.)


  • Thank you for responding. In looking at the manual from the link you provided, I see the following below. In my highlighted area, there seems to be an operand missing in the statement: "if (index   0)", can you please let me know what that operand should maybe "==" ?

  • Manual example with missing operand in example...

  • Hi,

    Thank you for notifying this observation to us. This documentation issue is being fixed in "Compiler and Library Manual for Blackfin Processors" that included as part of the CCES help for the upcoming release of CCES.

    Below are the updated statements regarding the missing operator.

    index += incr;
    if (index < 0)
    index += len;
    else if (index >= len)
    index -= len;

    CCES manuals are available(Licensing Guide, Assembler Preprocessor, Linker Manual, Loader Utilities Manual, Compiler, etc.,.) from the help path of CrossCore Embedded Studio IDE itself.

    Help Contents > CrossCore® Embedded Studio <version> >Blackfin® Development Tools Documentation>
    >>Assembler and Preprocessor Manual
    >>C/C++ Compiler and Library Manual for Blackfin Processors
    >>Dinkum C and C++ Libraries Reference
    >>Linker and Utilities Manual
    >>Loader and Utilities Manual

    Best Regards,