Sun WorkShop Compiler C 5.0 User's Guide

Integers(G.3.5)

(6.1.2.5)The representations and sets of values of the various types of integers:

Table B-1 Representations and Sets of Values of Integers

Integer 

Bits 

Minimum 

Maximum 

char (SPARC) (Intel)

-128 

127 

 signed char

-128 

127 

 unsigned char

255 

 short

16 

-32768 

32767 

 signed short

16 

-32768 

32767 

 unsigned short

16 

65535 

 int

32 

-2147483648 

2147483647 

 signed int

32 

-2147483648 

2147483647 

 unsigned int

32 

4294967295 

 long (SPARC) v8

32 

-2147483648 

2147483647 

long (SPARC) v9 64 -9223372036854775808 9223372036854775807
 signed long (SPARC)v8

32 

-2147483648 

2147483647 

signed long (SPARC) v9 64 -9223372036854775808 9223372036854775807
 unsigned long (SPARC) v8

32 

4294967295 

unsigned long (SPARC) v9 64 0 18446744073709551615
long long [Not valid in -Xc mode]

64 

-9223372036854775808 

9223372036854775807 

 signed long long1

64 

-9223372036854775808 

9223372036854775807 

 unsigned long long1

64 

18446744073709551615 

(6.2.1.2)The result of converting an integer to a shorter signed integer, or the result of converting an unsigned integer to a signed integer of equal length, if the value cannot be represented:

When an integer is converted to a shorter signed integer, the low order bits are copied from the longer integer to the shorter signed integer. The result may be negative.

When an unsigned integer is converted to a signed integer of equal size, the low order bits are copied from the unsigned integer to the signed integer. The result may be negative.

(6.3)The results of bitwise operations on signed integers:

The result of a bitwise operation applied to a signed type is the bitwise operation of the operands, including the sign bit. Thus, each bit in the result is set if--and only if--each of the corresponding bits in both of the operands is set.

(6.3.5)The sign of the remainder on integer division:

The result is the same sign as the dividend; thus, the remainder of -23/4 is -3.

(6.3.7)The result of a right shift of a negative-valued signed integral type:

The result of a right shift is a signed right shift.