5.1 Introduction

Built-in functions give the C programmer access to assembler operators or machine instructions that are currently only accessible using in-line assembly but are sufficiently useful that they are applicable in a broad range of applications. Built-in functions are coded in C source files syntactically like function calls, but they are compiled to assembly code that directly implements the function and does not involve function calls or library routines.

The built-in functions are preferred by programmers more than in-line assembly, for the following reasons :

  • Providing built-in functions for specific purposes simplifies coding
  • Certain optimizations are disabled when in-line assembly is used as compared to built-in functions.
  • For machine instructions that use dedicated registers, coding with in-line assembly needs care to avoid register allocation errors . The built-in functions make this process simpler as the user need not be concerned with the particular register requirements for each individual machine instruction.

The built-in functions are listed below, followed by their individual detailed descriptions. For more information, refer to files "builtins_16.h" and "builtins_32.h".

The compiler provides additional built-in functions for operations such as writing to Flash program memory and changing the oscillator settings. For a complete list of compiler built-in functions, refer to the MPLAB® XC32 C Compiler User's Guide for PIC32A MCU (DS50003831).