summaryrefslogtreecommitdiff
path: root/sys/include/ape
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2015-07-13 02:36:48 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2015-07-13 02:36:48 +0200
commit737c3edeba2c7615e08d9263e9eb010bbfd1e42b (patch)
tree4b149d907737ccfd233467dbf6789bbe5587f0b2 /sys/include/ape
parentcd9da74cbc2ff04de2179565bf31d8536eb9bd6b (diff)
ape: add stdint.h, fix SSIZE_MAX and add SIZE_MAX to limits.h
Diffstat (limited to 'sys/include/ape')
-rw-r--r--sys/include/ape/inttypes.h31
-rw-r--r--sys/include/ape/limits.h3
-rw-r--r--sys/include/ape/stdint.h33
3 files changed, 54 insertions, 13 deletions
diff --git a/sys/include/ape/inttypes.h b/sys/include/ape/inttypes.h
index 55725d54a..658e338db 100644
--- a/sys/include/ape/inttypes.h
+++ b/sys/include/ape/inttypes.h
@@ -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
diff --git a/sys/include/ape/limits.h b/sys/include/ape/limits.h
index c5f0c6e44..0b05c0df3 100644
--- a/sys/include/ape/limits.h
+++ b/sys/include/ape/limits.h
@@ -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
diff --git a/sys/include/ape/stdint.h b/sys/include/ape/stdint.h
new file mode 100644
index 000000000..3470981f5
--- /dev/null
+++ b/sys/include/ape/stdint.h
@@ -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