# Vault 7: Projects

This publication series is about specific projects related to the Vault 7 main publication.

### Protego

# MPLAB XC16 C-Compiler

- 1
- 2
…
- 138
- 139
- 140
- 141
- 142
…
- 365
- 366

MPLAB
®
XC16 C Compiler Users Guide
DS50002071C-page 140  2012-2013 Microchip Technology Inc.
The _Sat type specifier, indicating that the values are saturated, may be used with any
type as described in N1169.
Unsigned types are represented identically to signed types, but negative numbers (sign
bit 1) are not valid values in the unsigned types. Signed types saturate at the most neg-
ative and positive numbers representable in the underlying format. Unsigned types sat-
urate at 0 and the most positive number representable in the format.
The default behavior of overflow on signed or unsigned types is not saturation (as
defined by the pragmas described in section 4.1.3 Rounding and Overflow of N1169).
Therefor variables in signed or unsigned types that are not declared as saturating with
the _Sat specifier may receive invalid values when assigned the result of an expres-
sion in which an overflow may occur (the results of non-saturating overflows are not
defined.)
9.4 ROUNDING
Three rounding modes are supported, corresponding to the three rounding modes sup-
ported by the 16-bit device fixed-point multiplication facilities.
All operations on fixed point variables, whether intrinsically supported by the hardware
or not, are performed according to the prevailing rounding mode chosen. The rounding
mode may be specified globally via the -menable-fixed compiler switch, as
described in Section 5.7 Driver Option Descriptions, or on a function-by-function
basis, via the -round attribute, as described in Section 13.2.2 Function Attributes
These modes are described in more detail in the 16-bit MCU and DSC Programmers
Reference Manual (DS70157).
9.5 DIVISION BY ZERO
The result of a division of a _Fract or _Accum typed value by zero is not defined, and
may or may not result in an arithmetic error trap. Regardless of the presence of the
_Sat keyword, division by zero does NOT produce the most negative or most positive
saturation value for the result type.
signed long _Fract 1.31
unsigned long _Fract 1.31 (sign bit 0)
_Accum 9.31
short _Accum 9.31
long _Accum 9.31
signed _Accum 9.31
signed short _Accum 9.31
signed long _Accum 9.31
unsigned _Accum 9.31 (sign bit 0)
unsigned short _Accum 9.31 (sign bit 0)
unsigned long _Accum 9.31 (sign bit 0)
TABLE 9-2: FIXED POINT FORMATS - C DATA TYPES (CONTINUED)
Type Format
TABLE 9-3: ROUNDING MODES
Mode Description
Truncation Truncate signed result - round toward -saturation
Conventional Round signed result to nearest, ties toward +saturation
Convergent Round signed result to nearest, ties to even

- 1
- 2
…
- 138
- 139
- 140
- 141
- 142
…
- 365
- 366