4.10 Overflow and carry status flags for C and C++ code

The implementation of the European Telecommunications Standards Institute (ETSI) basic operations in dspfns.h exposes the status flags Overflow and Carry.

These flags are available as global variables for use in your own C or C++ programs. For example:

#include <dspfns.h>          /* include ETSI intrinsics */
#include <stdio.h>
const int BUFLEN=255;
int a[BUFLEN], b[BUFLEN], c[BUFLEN];
Overflow = 0;                      /* clear overflow flag */
for (i = 0; i < BUFLEN; ++i) {
    c[i] = L_add(a[i], b[i]);      /* saturated add of a[i] and b[i] */
if (Overflow)
    fprintf(stderr, "Overflow on saturated addition\n");

Generally, saturating functions have a sticky effect on overflow. That is, the overflow flag remains set until it is explicitly cleared.

Non-ConfidentialPDF file icon PDF versionARM DUI0472M
Copyright © 2010-2016 ARM Limited or its affiliates. All rights reserved.