change types to match stdint

have printf test print the sizes of these.
This commit is contained in:
Mariano Alvira 2010-03-17 17:27:21 -04:00
parent ef0a049035
commit 7272f9aec3
2 changed files with 20 additions and 5 deletions

View File

@ -5,9 +5,9 @@ typedef signed char int8_t;
typedef unsigned char uint8_t; typedef unsigned char uint8_t;
typedef signed short int16_t; typedef signed short int16_t;
typedef unsigned short uint16_t; typedef unsigned short uint16_t;
typedef signed long int32_t; typedef signed int int32_t;
typedef unsigned long uint32_t; typedef unsigned int uint32_t;
typedef signed long long int64_t; typedef signed long long int int64_t;
typedef unsigned long long uint64_t; typedef unsigned long long int uint64_t;
#endif #endif

View File

@ -6,6 +6,12 @@
#include "tests.h" #include "tests.h"
#include "config.h" #include "config.h"
#define print_size(x) do { \
printf("sizeof("); \
printf(#x); \
printf("): %d\n", sizeof(x)); \
} while(0)
int main(void) int main(void)
{ {
char *ptr = "Hello world!"; char *ptr = "Hello world!";
@ -17,6 +23,15 @@ int main(void)
uart_init(INC, MOD, SAMP); uart_init(INC, MOD, SAMP);
print_size(int8_t);
print_size(uint8_t);
print_size(int16_t);
print_size(uint16_t);
print_size(int32_t);
print_size(uint32_t);
print_size(int64_t);
print_size(uint64_t);
mi = (1 << (bs-1)) + 1; mi = (1 << (bs-1)) + 1;
printf("%s\n", ptr); printf("%s\n", ptr);
printf("printf test\n"); printf("printf test\n");
@ -39,7 +54,7 @@ int main(void)
// sprintf(buf, "-3: %-4d left justif.\n", -3); printf("%s", buf); // sprintf(buf, "-3: %-4d left justif.\n", -3); printf("%s", buf);
// sprintf(buf, "-3: %4d right justif.\n", -3); printf("%s", buf); // sprintf(buf, "-3: %4d right justif.\n", -3); printf("%s", buf);
return 0; while(1) { continue; }
} }
/* /*