Renesas TM V.3.20A Spezifikationen Seite 64

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 762
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 63
Renesas Technology, Tools FAQs
Last Updated: December 20, 2000
Document Number: 01051240_e
Q.
When executing the following program, long-type variable "l" is supposed to hold "-1". However, the results become 0xF(15). How
can I make the results be "-1"?
void main( void )
{
struct
{
short r : 10 ;
short i : 4 ;
short s : 2 ;
} buf ;
long l ;
buf.i = -1 ;
l = (long)buf.i ;
}
A.
NC30WA processes the bit field member type as 'unsigned'. Therefore, when a long type variable is stored (transferred), the value is
'zero-expanded'. To have this treated as 'signed', make sure you explicitly declare it as 'signed' in the bit field member type
declaration.
[Example]
struct
{
signed short r : 10 ;
signed short i : 4 ;
signed short s : 2 ;
} buf ;
Top of Page | Back to Previous Page
Terms of Use Privacy Policy
(C)2004 Renesas Technology Corp., All Rights Reserved.
Seitenansicht 63
1 2 ... 59 60 61 62 63 64 65 66 67 68 69 ... 761 762

Kommentare zu diesen Handbüchern

Keine Kommentare