Vault 7: Projects

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

MPLAB
®
XC16 C Compiler Users Guide
DS50002071C-page 302 2012-2013 Microchip Technology Inc.
__builtin_btg
Description: This function will generate a btg machine instruction.
Some examples include:
int i; /* near by default */
int l __attribute__((far));
struct foo {
int bit1:1;
} barbits;
int bar;
void some_bittoggles() {
register int j asm("w9");
int k;
k = i;
__builtin_btg(&i,1);
__builtin_btg(&j,3);
__builtin_btg(&k,4);
__builtin_btg(&l,11);
return j+k;
}
Note that taking the address of a variable in a register will produce warning by the compiler
and cause the register to be saved onto the stack (so that its address may be taken); this
form is not recommended. This caution only applies to variables explicitly placed in registers
by the programmer.
Prototype: void __builtin_btg(unsigned int *, unsigned int 0xn);
Argument: * A pointer to the data item for which a bit should be toggled.
0xn A literal value in the range of 0 to 15.
Return Value: Returns a btg machine instruction.
Assembler Operator/
Machine Instruction:
btg
Error Messages An error message will be displayed if the parameter values are not within range
__builtin_clr
Description: Clear the specified accumulator. For example:
volatile register int result asm("A");
result = __builtin_clr();
will generate:
clr A
Prototype: int __builtin_clr(void);
Argument: None
Return Value: Returns the cleared value result to an accumulator.
Assembler Operator/
Machine Instruction:
clr
Error Messages An error message will be displayed if the result is not an accumulator register.

e-Highlighter

Click to send permalink to address bar, or right-click to copy permalink.

Un-highlight all Un-highlight selectionu Highlight selectionh