SW500011 Microchip Technology, SW500011 Datasheet - Page 84

HI-TECH X PRO FOR PIC32

SW500011

Manufacturer Part Number
SW500011
Description
HI-TECH X PRO FOR PIC32
Manufacturer
Microchip Technology
Type
Compilerr
Series
PIC32r
Datasheet

Specifications of SW500011

No. Of User Licenses
1
Supported Families
PIC32
Core Architecture
PIC
Supported Hosts
Windows XP, Vista, Linux, Mac OS X
Software Edition
Professional
Kit Contents
Software And Docs
Tool Type
Compiler
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
PIC32 Series
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
Other names
032
778-1007
778-1007
Operators
operator toggles each bit within a value. Consider the following code.
If c contains the value 55h, it often assumed that ~c will produce AAh, however the result is FFAAh
and so the comparison above would fail. The compiler may be able to issue a mismatched compari-
son error to this effect in some circumstances. Again, a cast could be used to change this behaviour.
with char-type operands, but with int-type operands. However there are circumstances when the
result of an operation is identical regardless of whether the operands are of type char or int. In
these cases, HI-TECH C PRO for the PIC32 MCU Family will not perform the integral promotion
so as to increase the code efficiency. Consider the following example.
Strictly speaking, this statement requires that the values of b and c should be promoted to unsigned
int, the addition performed, the result of the addition cast to the type of a, and then the assignment
can take place. Even if the result of the unsigned int addition of the promoted values of b and c
was different to the result of the unsigned char addition of these values without promotion, after
the unsigned int result was converted back to unsigned char, the final result would be the same.
An 8-bit addition is more efficient than a 16-bit addition and so the compiler will encode the former.
to be performed to comply with the ANSI standard.
3.7.2 Shifts applied to integral types
The ANSI standard states that the result of right shifting (> > operator) signed integral types is
implementation defined when the operand is negative. Typically, the possible actions that can be
taken are that when an object is shifted right by one bit, the bit value shifted into the most significant
bit of the result can either be zero, or a copy of the most significant bit before the shift took place.
The latter case amounts to a sign extension of the number.
signed int or signed long). Thus an object with the signed int value 01240000h shifted right
one bit will yield the value 00920000h and the value 80240000h shifted right one bit will yield the
value C0120000h.
84
Another problem that frequently occurs is with the bitwise compliment operator, “~”. This
The consequence of integral promotion as illustrated above is that operations are not performed
If, in the above example, the type of a was unsigned int, then integral promotion would have
PICC-32 performs a sign extension of any signed integral type (for example signed char,
unsigned char count, c;
c = 0x55;
if( ~c == 0xAA)
unsigned char a, b, c;
a = b + c;
count++;
C Language Features

Related parts for SW500011