matos/core/stdarg.h

58 lines
1.2 KiB
C
Raw Normal View History

2018-07-20 15:41:58 +02:00
#pragma once
typedef __signed__ char __s8;
typedef unsigned char __u8;
typedef __signed__ short __s16;
typedef unsigned short __u16;
typedef __signed__ int __s32;
typedef unsigned int __u32;
#ifdef __GNUC__
__extension__ typedef __signed__ long long __s64;
__extension__ typedef unsigned long long __u64;
#else
typedef __signed__ long long __s64;
typedef unsigned long long __u64;
#endif
/* sysv */
typedef unsigned char unchar;
typedef unsigned short ushort;
typedef unsigned int uint;
typedef unsigned long ulong;
2018-07-20 15:41:58 +02:00
typedef __s8 int8_t;
typedef __s16 int16_t;
typedef __s32 int32_t;
2018-07-20 15:41:58 +02:00
typedef __u8 uint8_t;
typedef __u16 uint16_t;
typedef __u32 uint32_t;
2018-07-20 15:41:58 +02:00
typedef __u64 uint64_t;
typedef __u64 u_int64_t;
typedef __s64 int64_t;
2018-07-20 15:41:58 +02:00
typedef enum { FALSE = 0, TRUE } bool_t;
#define NULL ((void *)0)
2018-07-20 15:41:58 +02:00
#if __x86_64__
typedef unsigned long size_t;
typedef long ssize_t;
typedef unsigned long int uintptr_t;
typedef long int intptr_t;
2018-07-20 15:41:58 +02:00
#else
typedef unsigned int size_t;
typedef int ssize_t;
typedef unsigned int uintptr_t;
typedef int intptr_t;
2018-07-20 15:41:58 +02:00
#endif
2021-11-13 08:31:05 +01:00
//__builtin_va_list could be used instead
typedef char *va_list;
#define va_start(v, l) ((v) = (va_list) & (l) + sizeof(l))
#define va_end(v) ((v) = NULL)
#define va_arg(v, type) (*(type *)(((v) += sizeof(type)) - sizeof(type)))