Fix data types header file and declarations to work on Linux.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3851 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Vikram S. Adve 2002-09-20 01:05:16 +00:00
parent ba3b3e86d1
commit ad6b4f3b5e

View File

@ -1,40 +1,43 @@
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#define __STDC_LIMIT_MACROS 1
#include <inttypes.h>
int
main(int argc, char** argv)
{
char c1;
short s1, ssf1, ssd1;
uint8_t ubs0;
int8_t bs0;
char c1;
short s1, ssf1, ssd1;
uint8_t ubs0;
int8_t bs0;
unsigned char ubc0, uc2;
unsigned short us2, usf1, usd1;
int ic3, is3, sif1, sid1;
uint uic4, uis4, uif1, uid1;
long slf1, sld1;
ulong ulf1, uld1;
float f1;
double d1;
unsigned short us2, usf1, usd1;
int ic3, is3, sif1, sid1;
unsigned uic4, uis4, uif1, uid1;
long slf1, sld1;
unsigned long ulf1, uld1;
float f1;
double d1;
/* Test integer to integer conversions */
c1 = (char) (argc >= 2)? atoi(argv[1]) : 0xff64; /* 100 = 'd' */
s1 = (short) (argc >= 3)? atoi(argv[2]) : -769; /* 0xf7ff = -769 */
s1 = (short) (argc >= 3)? atoi(argv[2]) : -769; /* 0xfcff = -769 */
ubc0 = (unsigned char) c1; /* 100 = 'd' */
ubs0 = (uint8_t) s1; /* 0xff = 255 */
bs0 = (int8_t) s1; /* 0xff = -1 */
uc2 = (unsigned char) c1; /* 100 = 'd' */
us2 = (unsigned short) s1; /* 0xf7ff = 64767 */
us2 = (unsigned short) s1; /* 0xfcff = 64767 */
ic3 = (int) c1; /* 100 = 'd' */
is3 = (int) s1; /* 0xfffff7ff = -769 */
is3 = (int) s1; /* 0xfffffcff = -769 */
uic4 = (unsigned int) c1; /* 100 = 'd' */
uis4 = (unsigned int) s1; /* 0xfffff7ff = 4294966527 */
uis4 = (unsigned int) s1; /* 0xfffffcff = 4294966527 */
printf("ubc0 = '%c'\n", ubc0);
printf("ubs0 = %u\n", ubs0);
@ -70,15 +73,15 @@ main(int argc, char** argv)
printf("usd1 = %u\n", usd1);
printf("uif1 = %u\n", uif1);
printf("uid1 = %u\n", uid1);
printf("ulf1 = %u\n", ulf1);
printf("uld1 = %u\n", uld1);
printf("ulf1 = %lu\n", ulf1);
printf("uld1 = %lu\n", uld1);
printf("ssf1 = %d\n", ssf1);
printf("ssd1 = %d\n", ssd1);
printf("sif1 = %d\n", sif1);
printf("sid1 = %d\n", sid1);
printf("slf1 = %d\n", slf1);
printf("sld1 = %d\n", sld1);
printf("slf1 = %ld\n", slf1);
printf("sld1 = %ld\n", sld1);
return 0;
}