ape: add stdint.h, fix SSIZE_MAX and add SIZE_MAX to limits.h

front
cinap_lenrek 2015-07-13 02:36:48 +02:00
parent cd9da74cbc
commit 737c3edeba
5 changed files with 85 additions and 34 deletions

View File

@ -1,21 +0,0 @@
#ifndef _SUSV2_SOURCE
#error "inttypes.h is SUSV2"
#endif
#ifndef _INTTYPES_H_
#define _INTTYPES_H_ 1
typedef char int8_t;
typedef short int16_t;
typedef int int32_t;
typedef long long int64_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
typedef unsigned long long uint64_t;
typedef long long intptr_t;
typedef unsigned long long uintptr_t;
#endif

View File

@ -0,0 +1,31 @@
#ifndef _STDINT_H_
#define _STDINT_H_ 1
typedef char int8_t;
typedef short int16_t;
typedef int int32_t;
typedef long long int64_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
typedef unsigned long long uint64_t;
typedef long long intptr_t;
typedef unsigned long long uintptr_t;
#define INT8_MIN 0x80
#define INT16_MIN 0x8000
#define INT32_MIN 0x80000000
#define INT64_MIN 0x8000000000000000LL
#define INT8_MAX 0x7f
#define INT16_MAX 0x7fff
#define INT32_MAX 0x7fffffff
#define INT64_MAX 0x7fffffffffffffffULL
#define UINT8_MAX 0xff
#define UINT16_MAX 0xffff
#define UINT32_MAX 0xffffffffL
#define UINT64_MAX 0xffffffffffffffffULL
#endif

View File

@ -5,19 +5,26 @@
#ifndef _INTTYPES_H_
#define _INTTYPES_H_ 1
typedef int _intptr_t;
typedef unsigned int _uintptr_t;
#include <stdint.h>
#define PRId8 "d"
#define PRId16 "d"
#define PRId32 "d"
#define PRId64 "lld"
typedef char int8_t;
typedef short int16_t;
typedef int int32_t;
typedef long long int64_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
typedef unsigned long long uint64_t;
typedef _intptr_t intptr_t;
typedef _uintptr_t uintptr_t;
#define PRIo8 "o"
#define PRIo16 "o"
#define PRIo32 "o"
#define PRIo64 "llo"
#define PRIx8 "x"
#define PRIx16 "x"
#define PRIx32 "x"
#define PRIx64 "llx"
#define PRIu8 "u"
#define PRIu16 "u"
#define PRIu32 "u"
#define PRIu64 "llu"
#endif

View File

@ -47,7 +47,7 @@
#define _POSIX_SEM_NSEMS_MAX 256
#define _POSIX_SEM_VALUE_MAX 32767
#define _POSIX_SIGQUEUE_MAX 32
#define _POSIX_SSIZE_MAX 32767
#define _POSIX_SSIZE_MAX SSIZE_MAX
#define _POSIX_STREAM_MAX 8
#define _POSIX_TIMER_MAX 32
#define _POSIX_TZNAME_MAX 3
@ -76,6 +76,7 @@
/*#define SEM_VALUE_MAX _POSIX_SEM_VALUE_MAX */
/*#define SIGQUEUE_MAX _POSIX_SIGQUEUE_MAX */
#define SSIZE_MAX LONG_MAX
#define SIZE_MAX ULONG_MAX
/*#define STREAM_MAX _POSIX_STREAM_MAX */
/*#define TIMER_MAX _POSIX_TIMER_MAX */
#define TZNAME_MAX _POSIX_TZNAME_MAX

33
sys/include/ape/stdint.h Normal file
View File

@ -0,0 +1,33 @@
#ifndef _STDINT_H_
#define _STDINT_H_ 1
typedef int _intptr_t;
typedef unsigned int _uintptr_t;
typedef char int8_t;
typedef short int16_t;
typedef int int32_t;
typedef long long int64_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
typedef unsigned long long uint64_t;
typedef _intptr_t intptr_t;
typedef _uintptr_t uintptr_t;
#define INT8_MIN 0x80
#define INT16_MIN 0x8000
#define INT32_MIN 0x80000000
#define INT64_MIN 0x8000000000000000LL
#define INT8_MAX 0x7f
#define INT16_MAX 0x7fff
#define INT32_MAX 0x7fffffff
#define INT64_MAX 0x7fffffffffffffffULL
#define UINT8_MAX 0xff
#define UINT16_MAX 0xffff
#define UINT32_MAX 0xffffffffL
#define UINT64_MAX 0xffffffffffffffffULL
#endif