Thread: Signed Ints??
View Single Post
  #2   Spotlight this post!  
Unread 22-02-2004, 10:05
seanwitte seanwitte is offline
Registered User
None #0116
Team Role: Engineer
 
Join Date: Nov 2002
Location: Herndon, VA
Posts: 378
seanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant future
Send a message via AIM to seanwitte
Re: Signed Ints??

Yes, you can used signed ints in your code. We're using a header file with the following types defined in it:

Code:
//data type definitions for integers - C18

//uchar
//size:	8 bits (1 byte)
//range: 0 to 255
typedef unsigned char uchar;	

//schar
//size: 8 bits (1 byte)
//range: -128 to 127
typedef signed char schar;

//uint16
//size: 16 bits (2 bytes)
//range: 0 to 65535
typedef unsigned int uint16;	

//sint16
//size: 16 bits (2 bytes)
//range: -32768 to 32767
typedef signed int sint16;	

//uint24
//size: 24 bits (3 bytes)
//range: 0 to 16,777,215
typedef unsigned short long uint24;

//sint24
//size: 24 bits (3 bytes)
//range: -8,388,608 to 8,388,607
typedef signed short long sint24;

//uint32
//size: 32 bits (4 bytes)
//range: 0 to 4,294,967,295
typedef unsigned long uint32;

//sint32
//size: 32 bits (4 bytes)
//range: -2,147,483,648 to 2,147,483,647
typedef signed long sint32;
So, if you want a 4-byte signed integer you can declare it as a sint32. An unsigned 3-byte integer is a uint24, etc.