Vault 7: Projects

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

© 2005-2011 Microchip Technology Inc. DS70157F-page 449
Section 6. Built-in Functions
Built-in Functions
6
__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 appears if the parameter values are not within range.

e-Highlighter

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

Un-highlight all Un-highlight selectionu Highlight selectionh