From e9d4e8d70a69d40572d5306069d0828db632bbe3 Mon Sep 17 00:00:00 2001 From: Ralf Corsepius Date: Tue, 26 Oct 2004 11:02:39 +0000 Subject: New. --- cpukit/libcsupport/include/rtems/_inttypes.h | 71 ++++++++++++++++++++++++++++ cpukit/libcsupport/include/rtems/_stdint.h | 71 ++++++++++++++++++++++++++++ 2 files changed, 142 insertions(+) create mode 100644 cpukit/libcsupport/include/rtems/_inttypes.h create mode 100644 cpukit/libcsupport/include/rtems/_stdint.h (limited to 'cpukit/libcsupport') diff --git a/cpukit/libcsupport/include/rtems/_inttypes.h b/cpukit/libcsupport/include/rtems/_inttypes.h new file mode 100644 index 0000000000..b9167e9f95 --- /dev/null +++ b/cpukit/libcsupport/include/rtems/_inttypes.h @@ -0,0 +1,71 @@ +/* + * COPYRIGHT (c) 2004. + * Ralf Corsepius, Ulm/Germany. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + * + * $Id$ + */ + +#ifndef __rtems__inttypes_h +#define __rtems__inttypes_h + +#include + +#define __STRINGIFY(a) #a + +/* 8-bit types */ +#define __PRI8(x) __STRINGIFY(x) + +#define PRId8 __PRI8(d) +#define PRIi8 __PRI8(i) +#define PRIo8 __PRI8(o) +#define PRIu8 __PRI8(u) +#define PRIx8 __PRI8(x) +#define PRIX8 __PRI8(X) + + +/* 16-bit types */ +#define __PRI16(x) __STRINGIFY(x) + +#define PRId16 __PRI16(d) +#define PRIi16 __PRI16(i) +#define PRIo16 __PRI16(o) +#define PRIu16 __PRI16(u) +#define PRIx16 __PRI16(x) +#define PRIX16 __PRI16(X) + +/* 32-bit types */ +#if defined(__rtems_long32) +#define __PRI32(x) __STRINGIFY(l##x) +#else +#define __PRI32(x) __STRINGIFY(x) +#endif + +#define PRId32 __PRI32(d) +#define PRIi32 __PRI32(i) +#define PRIo32 __PRI32(o) +#define PRIu32 __PRI32(u) +#define PRIx32 __PRI32(x) +#define PRIX32 __PRI32(X) + + +/* 64-bit types */ +#if defined(__rtems_longlong64) +#define __PRI64(x) __STRINGIFY(ll##x) +#elif defined(__rtems_longlong64) +#define __PRI64(x) __STRINGIFY(l##x) +#else +#define __PRI64(x) __STRINGIFY(x) +#endif + +#define PRId64 __PRI64(d) +#define PRIi64 __PRI64(i) +#define PRIo64 __PRI64(o) +#define PRIu64 __PRI64(u) +#define PRIx64 __PRI64(x) +#define PRIX64 __PRI64(X) + +#endif /* __rtems__inttypes_h */ diff --git a/cpukit/libcsupport/include/rtems/_stdint.h b/cpukit/libcsupport/include/rtems/_stdint.h new file mode 100644 index 0000000000..8f2fc180b5 --- /dev/null +++ b/cpukit/libcsupport/include/rtems/_stdint.h @@ -0,0 +1,71 @@ +/* + * COPYRIGHT (c) 2004. + * Ralf Corsepius, Ulm/Germany. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + * + * $Id$ + */ + +#ifndef __rtems__stdint_h +#define __rtems__stdint_h + +#ifdef __GNUC__ +#define __EXP(x) __##x##__ +#else +#define __EXP(x) x +#include +#endif + +#if __EXP(SCHAR_MAX) == 0x7f +typedef signed char __rtems_int8_t ; +typedef unsigned char __rtems_uint8_t ; +#endif + +#if __EXP(INT_MAX) == 0x7fff +typedef signed int __rtems_int16_t; +typedef unsigned int __rtems_uint16_t; +#elif __EXP(SHRT_MAX) == 0x7fff +typedef signed short __rtems_int16_t; +typedef unsigned short __rtems_uint16_t; +#elif __EXP(SCHAR_MAX) == 0x7fff +typedef signed char __rtems_int32_t; +typedef unsigned char __rtems_uint32_t; +#endif + +#if __EXP(INT_MAX) == 0x7fffffff +typedef signed int __rtems_int32_t; +typedef unsigned int __rtems_uint32_t; +#elif __EXP(LONG_MAX) == 0x7fffffff +typedef signed long __rtems_int32_t; +typedef unsigned long __rtems_uint32_t; +#define __rtems_long32 1 +#elif __EXP(SHRT_MAX) == 0x7fffffff +typedef signed short __rtems_int32_t; +typedef unsigned short __rtems_uint32_t; +#elif __EXP(SCHAR_MAX) == 0x7fffffff +typedef signed char __rtems_int32_t; +typedef unsigned char __rtems_uint32_t; +#endif + +#if __EXP(LONG_MAX) == 0x7fffffffffffffff +typedef signed long int __rtems_int64_t; +typedef unsigned long int __rtems_uint64_t; +#define __rtems_long64 1 +#elif __EXP(LONG_LONG_MAX) == 0x7fffffffffffffff +typedef signed long int __rtems_int64_t; +typedef unsigned long int __rtems_uint64_t; +#define __rtems_longlong64 1 +#elif __EXP(INT_MAX) == 0x7fffffffffffffff +typedef signed int __rtems_int64_t; +typedef unsigned int __rtems_uint64_t; +#endif + +#undef __EXP + +typedef signed long intptr_t; +typedef unsigned long uintptr_t; + +#endif /* __rtems__stdint_h */ -- cgit v1.2.3