2024-01-02 21:14:05 +03:00
|
|
|
/* Copyright (C) 2022-2024 mintsuki and contributors.
|
2023-12-05 14:25:52 +03:00
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
|
|
|
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
|
|
|
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2024-09-09 12:52:37 +03:00
|
|
|
#ifndef __FSTD_HDRS_STDINT_H
|
2023-04-16 08:24:29 +03:00
|
|
|
#define __FSTD_HDRS_STDINT_H 1
|
2022-02-15 07:46:37 +03:00
|
|
|
|
2023-04-25 22:01:40 +03:00
|
|
|
#ifdef __UINT8_TYPE__
|
2022-02-15 07:46:37 +03:00
|
|
|
typedef __UINT8_TYPE__ uint8_t;
|
2023-04-25 22:01:40 +03:00
|
|
|
#endif
|
|
|
|
#ifdef __UINT16_TYPE__
|
2022-02-15 07:46:37 +03:00
|
|
|
typedef __UINT16_TYPE__ uint16_t;
|
2023-04-25 22:01:40 +03:00
|
|
|
#endif
|
|
|
|
#ifdef __UINT32_TYPE__
|
2022-02-15 07:46:37 +03:00
|
|
|
typedef __UINT32_TYPE__ uint32_t;
|
2023-04-25 22:01:40 +03:00
|
|
|
#endif
|
|
|
|
#ifdef __UINT64_TYPE__
|
2022-02-15 07:46:37 +03:00
|
|
|
typedef __UINT64_TYPE__ uint64_t;
|
2023-04-25 22:01:40 +03:00
|
|
|
#endif
|
2022-02-15 07:46:37 +03:00
|
|
|
|
2022-06-24 08:07:27 +03:00
|
|
|
typedef __UINT_LEAST8_TYPE__ uint_least8_t;
|
|
|
|
typedef __UINT_LEAST16_TYPE__ uint_least16_t;
|
|
|
|
typedef __UINT_LEAST32_TYPE__ uint_least32_t;
|
|
|
|
typedef __UINT_LEAST64_TYPE__ uint_least64_t;
|
|
|
|
|
|
|
|
typedef __UINT_FAST8_TYPE__ uint_fast8_t;
|
|
|
|
typedef __UINT_FAST16_TYPE__ uint_fast16_t;
|
|
|
|
typedef __UINT_FAST32_TYPE__ uint_fast32_t;
|
|
|
|
typedef __UINT_FAST64_TYPE__ uint_fast64_t;
|
|
|
|
|
2023-04-25 22:01:40 +03:00
|
|
|
#ifdef __INT8_TYPE__
|
2022-02-15 07:46:37 +03:00
|
|
|
typedef __INT8_TYPE__ int8_t;
|
2023-04-25 22:01:40 +03:00
|
|
|
#endif
|
|
|
|
#ifdef __INT16_TYPE__
|
2022-02-15 07:46:37 +03:00
|
|
|
typedef __INT16_TYPE__ int16_t;
|
2023-04-25 22:01:40 +03:00
|
|
|
#endif
|
|
|
|
#ifdef __INT32_TYPE__
|
2022-02-15 07:46:37 +03:00
|
|
|
typedef __INT32_TYPE__ int32_t;
|
2023-04-25 22:01:40 +03:00
|
|
|
#endif
|
|
|
|
#ifdef __INT64_TYPE__
|
2022-02-15 07:46:37 +03:00
|
|
|
typedef __INT64_TYPE__ int64_t;
|
2023-04-25 22:01:40 +03:00
|
|
|
#endif
|
2022-02-15 07:46:37 +03:00
|
|
|
|
2022-06-24 08:07:27 +03:00
|
|
|
typedef __INT_LEAST8_TYPE__ int_least8_t;
|
|
|
|
typedef __INT_LEAST16_TYPE__ int_least16_t;
|
|
|
|
typedef __INT_LEAST32_TYPE__ int_least32_t;
|
|
|
|
typedef __INT_LEAST64_TYPE__ int_least64_t;
|
|
|
|
|
|
|
|
typedef __INT_FAST8_TYPE__ int_fast8_t;
|
|
|
|
typedef __INT_FAST16_TYPE__ int_fast16_t;
|
|
|
|
typedef __INT_FAST32_TYPE__ int_fast32_t;
|
|
|
|
typedef __INT_FAST64_TYPE__ int_fast64_t;
|
|
|
|
|
2023-04-25 22:01:40 +03:00
|
|
|
#ifdef __UINTPTR_TYPE__
|
2022-02-15 07:46:37 +03:00
|
|
|
typedef __UINTPTR_TYPE__ uintptr_t;
|
2023-04-25 22:01:40 +03:00
|
|
|
#endif
|
|
|
|
#ifdef __INTPTR_TYPE__
|
2022-02-15 07:46:37 +03:00
|
|
|
typedef __INTPTR_TYPE__ intptr_t;
|
2023-04-25 22:01:40 +03:00
|
|
|
#endif
|
2022-02-15 07:46:37 +03:00
|
|
|
|
|
|
|
typedef __UINTMAX_TYPE__ uintmax_t;
|
|
|
|
typedef __INTMAX_TYPE__ intmax_t;
|
|
|
|
|
2022-08-17 15:46:27 +03:00
|
|
|
/* Clang and GCC have different mechanisms for INT32_C and friends. */
|
2022-06-24 08:07:27 +03:00
|
|
|
#ifdef __clang__
|
2023-04-16 08:24:29 +03:00
|
|
|
# ifndef __FSTD_HDRS_C_JOIN
|
|
|
|
# define __FSTD_HDRS_C_EXPAND_JOIN(x, suffix) x ## suffix
|
|
|
|
# define __FSTD_HDRS_C_JOIN(x, suffix) __FSTD_HDRS_C_EXPAND_JOIN(x, suffix)
|
2023-03-23 21:24:51 +03:00
|
|
|
# endif
|
2022-06-24 08:07:27 +03:00
|
|
|
|
2023-04-25 22:01:40 +03:00
|
|
|
# undef INT8_C
|
2023-04-16 08:24:29 +03:00
|
|
|
# define INT8_C(x) __FSTD_HDRS_C_JOIN(x, __INT8_C_SUFFIX__)
|
2023-04-25 22:01:40 +03:00
|
|
|
# undef INT16_C
|
2023-04-16 08:24:29 +03:00
|
|
|
# define INT16_C(x) __FSTD_HDRS_C_JOIN(x, __INT16_C_SUFFIX__)
|
2023-04-25 22:01:40 +03:00
|
|
|
# undef INT32_C
|
2023-04-16 08:24:29 +03:00
|
|
|
# define INT32_C(x) __FSTD_HDRS_C_JOIN(x, __INT32_C_SUFFIX__)
|
2023-04-25 22:01:40 +03:00
|
|
|
# undef INT64_C
|
2023-04-16 08:24:29 +03:00
|
|
|
# define INT64_C(x) __FSTD_HDRS_C_JOIN(x, __INT64_C_SUFFIX__)
|
2022-06-24 08:07:27 +03:00
|
|
|
|
2023-04-25 22:01:40 +03:00
|
|
|
# undef UINT8_C
|
2023-04-16 08:24:29 +03:00
|
|
|
# define UINT8_C(x) __FSTD_HDRS_C_JOIN(x, __UINT8_C_SUFFIX__)
|
2023-04-25 22:01:40 +03:00
|
|
|
# undef UINT16_C
|
2023-04-16 08:24:29 +03:00
|
|
|
# define UINT16_C(x) __FSTD_HDRS_C_JOIN(x, __UINT16_C_SUFFIX__)
|
2023-04-25 22:01:40 +03:00
|
|
|
# undef UINT32_C
|
2023-04-16 08:24:29 +03:00
|
|
|
# define UINT32_C(x) __FSTD_HDRS_C_JOIN(x, __UINT32_C_SUFFIX__)
|
2023-04-25 22:01:40 +03:00
|
|
|
# undef UINT64_C
|
2023-04-16 08:24:29 +03:00
|
|
|
# define UINT64_C(x) __FSTD_HDRS_C_JOIN(x, __UINT64_C_SUFFIX__)
|
2022-06-24 08:07:27 +03:00
|
|
|
|
2023-04-25 22:01:40 +03:00
|
|
|
# undef INTMAX_C
|
2023-04-16 08:24:29 +03:00
|
|
|
# define INTMAX_C(x) __FSTD_HDRS_C_JOIN(x, __INTMAX_C_SUFFIX__)
|
2023-04-25 22:01:40 +03:00
|
|
|
# undef UINTMAX_C
|
2023-04-16 08:24:29 +03:00
|
|
|
# define UINTMAX_C(x) __FSTD_HDRS_C_JOIN(x, __UINTMAX_C_SUFFIX__)
|
2022-06-24 08:07:27 +03:00
|
|
|
#else
|
2023-04-25 22:01:40 +03:00
|
|
|
# undef INT8_C
|
2023-03-23 21:24:51 +03:00
|
|
|
# define INT8_C(x) __INT8_C(x)
|
2023-04-25 22:01:40 +03:00
|
|
|
# undef INT16_C
|
2022-06-24 08:07:27 +03:00
|
|
|
# define INT16_C(x) __INT16_C(x)
|
2023-04-25 22:01:40 +03:00
|
|
|
# undef INT32_C
|
2022-06-24 08:07:27 +03:00
|
|
|
# define INT32_C(x) __INT32_C(x)
|
2023-04-25 22:01:40 +03:00
|
|
|
# undef INT64_C
|
2022-06-24 08:07:27 +03:00
|
|
|
# define INT64_C(x) __INT64_C(x)
|
|
|
|
|
2023-04-25 22:01:40 +03:00
|
|
|
# undef UINT8_C
|
2023-03-23 21:24:51 +03:00
|
|
|
# define UINT8_C(x) __UINT8_C(x)
|
2023-04-25 22:01:40 +03:00
|
|
|
# undef UINT16_C
|
2022-06-24 08:07:27 +03:00
|
|
|
# define UINT16_C(x) __UINT16_C(x)
|
2023-04-25 22:01:40 +03:00
|
|
|
# undef UINT32_C
|
2022-06-24 08:07:27 +03:00
|
|
|
# define UINT32_C(x) __UINT32_C(x)
|
2023-04-25 22:01:40 +03:00
|
|
|
# undef UINT64_C
|
2022-06-24 08:07:27 +03:00
|
|
|
# define UINT64_C(x) __UINT64_C(x)
|
|
|
|
|
2023-04-25 22:01:40 +03:00
|
|
|
# undef INTMAX_C
|
2022-06-24 08:07:27 +03:00
|
|
|
# define INTMAX_C(x) __INTMAX_C(x)
|
2023-04-25 22:01:40 +03:00
|
|
|
# undef UINTMAX_C
|
2022-06-24 08:07:27 +03:00
|
|
|
# define UINTMAX_C(x) __UINTMAX_C(x)
|
|
|
|
#endif
|
2022-02-15 07:46:37 +03:00
|
|
|
|
2023-04-25 22:01:40 +03:00
|
|
|
#ifdef __UINT8_MAX__
|
|
|
|
# undef UINT8_MAX
|
|
|
|
# define UINT8_MAX __UINT8_MAX__
|
|
|
|
#endif
|
|
|
|
#ifdef __UINT16_MAX__
|
|
|
|
# undef UINT16_MAX
|
|
|
|
# define UINT16_MAX __UINT16_MAX__
|
|
|
|
#endif
|
|
|
|
#ifdef __UINT32_MAX__
|
|
|
|
# undef UINT32_MAX
|
|
|
|
# define UINT32_MAX __UINT32_MAX__
|
|
|
|
#endif
|
|
|
|
#ifdef __UINT64_MAX__
|
|
|
|
# undef UINT64_MAX
|
|
|
|
# define UINT64_MAX __UINT64_MAX__
|
|
|
|
#endif
|
2022-02-15 07:46:37 +03:00
|
|
|
|
2023-04-25 22:01:40 +03:00
|
|
|
#ifdef __INT8_MAX__
|
|
|
|
# undef INT8_MAX
|
|
|
|
# define INT8_MAX __INT8_MAX__
|
|
|
|
#endif
|
|
|
|
#ifdef __INT16_MAX__
|
|
|
|
# undef INT16_MAX
|
|
|
|
# define INT16_MAX __INT16_MAX__
|
|
|
|
#endif
|
|
|
|
#ifdef __INT32_MAX__
|
|
|
|
# undef INT32_MAX
|
|
|
|
# define INT32_MAX __INT32_MAX__
|
|
|
|
#endif
|
|
|
|
#ifdef __INT64_MAX__
|
|
|
|
# undef INT64_MAX
|
|
|
|
# define INT64_MAX __INT64_MAX__
|
|
|
|
#endif
|
2022-06-24 08:07:27 +03:00
|
|
|
|
2023-04-25 22:01:40 +03:00
|
|
|
#ifdef __INT8_MAX__
|
|
|
|
# undef INT8_MIN
|
|
|
|
# define INT8_MIN (-INT8_MAX - 1)
|
|
|
|
#endif
|
|
|
|
#ifdef __INT16_MAX__
|
|
|
|
# undef INT16_MIN
|
|
|
|
# define INT16_MIN (-INT16_MAX - 1)
|
|
|
|
#endif
|
|
|
|
#ifdef __INT32_MAX__
|
|
|
|
# undef INT32_MIN
|
|
|
|
# define INT32_MIN (-INT32_MAX - 1)
|
|
|
|
#endif
|
|
|
|
#ifdef __INT64_MAX__
|
|
|
|
# undef INT64_MIN
|
|
|
|
# define INT64_MIN (-INT64_MAX - 1)
|
|
|
|
#endif
|
2022-02-15 07:46:37 +03:00
|
|
|
|
2023-04-25 22:01:40 +03:00
|
|
|
#undef UINT_LEAST8_MAX
|
2022-06-24 08:07:27 +03:00
|
|
|
#define UINT_LEAST8_MAX __UINT_LEAST8_MAX__
|
2023-04-25 22:01:40 +03:00
|
|
|
#undef UINT_LEAST16_MAX
|
2022-06-24 08:07:27 +03:00
|
|
|
#define UINT_LEAST16_MAX __UINT_LEAST16_MAX__
|
2023-04-25 22:01:40 +03:00
|
|
|
#undef UINT_LEAST32_MAX
|
2022-06-24 08:07:27 +03:00
|
|
|
#define UINT_LEAST32_MAX __UINT_LEAST32_MAX__
|
2023-04-25 22:01:40 +03:00
|
|
|
#undef UINT_LEAST64_MAX
|
2022-06-24 08:07:27 +03:00
|
|
|
#define UINT_LEAST64_MAX __UINT_LEAST64_MAX__
|
|
|
|
|
2023-04-25 22:01:40 +03:00
|
|
|
#undef INT_LEAST8_MAX
|
2022-06-24 08:07:27 +03:00
|
|
|
#define INT_LEAST8_MAX __INT_LEAST8_MAX__
|
2023-04-25 22:01:40 +03:00
|
|
|
#undef INT_LEAST16_MAX
|
2022-06-24 08:07:27 +03:00
|
|
|
#define INT_LEAST16_MAX __INT_LEAST16_MAX__
|
2023-04-25 22:01:40 +03:00
|
|
|
#undef INT_LEAST32_MAX
|
2022-06-24 08:07:27 +03:00
|
|
|
#define INT_LEAST32_MAX __INT_LEAST32_MAX__
|
2023-04-25 22:01:40 +03:00
|
|
|
#undef INT_LEAST64_MAX
|
2022-06-24 08:07:27 +03:00
|
|
|
#define INT_LEAST64_MAX __INT_LEAST64_MAX__
|
|
|
|
|
2023-04-25 22:01:40 +03:00
|
|
|
#undef INT_LEAST8_MIN
|
2022-06-24 08:07:27 +03:00
|
|
|
#define INT_LEAST8_MIN (-INT_LEAST8_MAX - 1)
|
2023-04-25 22:01:40 +03:00
|
|
|
#undef INT_LEAST16_MIN
|
2022-06-24 08:07:27 +03:00
|
|
|
#define INT_LEAST16_MIN (-INT_LEAST16_MAX - 1)
|
2023-04-25 22:01:40 +03:00
|
|
|
#undef INT_LEAST32_MIN
|
2022-06-24 08:07:27 +03:00
|
|
|
#define INT_LEAST32_MIN (-INT_LEAST32_MAX - 1)
|
2023-04-25 22:01:40 +03:00
|
|
|
#undef INT_LEAST64_MIN
|
2022-06-24 08:07:27 +03:00
|
|
|
#define INT_LEAST64_MIN (-INT_LEAST64_MAX - 1)
|
|
|
|
|
2023-04-25 22:01:40 +03:00
|
|
|
#undef UINT_FAST8_MAX
|
2022-06-24 08:07:27 +03:00
|
|
|
#define UINT_FAST8_MAX __UINT_FAST8_MAX__
|
2023-04-25 22:01:40 +03:00
|
|
|
#undef UINT_FAST16_MAX
|
2022-06-24 08:07:27 +03:00
|
|
|
#define UINT_FAST16_MAX __UINT_FAST16_MAX__
|
2023-04-25 22:01:40 +03:00
|
|
|
#undef UINT_FAST32_MAX
|
2022-06-24 08:07:27 +03:00
|
|
|
#define UINT_FAST32_MAX __UINT_FAST32_MAX__
|
2023-04-25 22:01:40 +03:00
|
|
|
#undef UINT_FAST64_MAX
|
2022-06-24 08:07:27 +03:00
|
|
|
#define UINT_FAST64_MAX __UINT_FAST64_MAX__
|
|
|
|
|
2023-04-25 22:01:40 +03:00
|
|
|
#undef INT_FAST8_MAX
|
2022-06-24 08:07:27 +03:00
|
|
|
#define INT_FAST8_MAX __INT_FAST8_MAX__
|
2023-04-25 22:01:40 +03:00
|
|
|
#undef INT_FAST16_MAX
|
2022-06-24 08:07:27 +03:00
|
|
|
#define INT_FAST16_MAX __INT_FAST16_MAX__
|
2023-04-25 22:01:40 +03:00
|
|
|
#undef INT_FAST32_MAX
|
2022-06-24 08:07:27 +03:00
|
|
|
#define INT_FAST32_MAX __INT_FAST32_MAX__
|
2023-04-25 22:01:40 +03:00
|
|
|
#undef INT_FAST64_MAX
|
2022-06-24 08:07:27 +03:00
|
|
|
#define INT_FAST64_MAX __INT_FAST64_MAX__
|
|
|
|
|
2023-04-25 22:01:40 +03:00
|
|
|
#undef INT_FAST8_MIN
|
2022-06-24 08:07:27 +03:00
|
|
|
#define INT_FAST8_MIN (-INT_FAST8_MAX - 1)
|
2023-04-25 22:01:40 +03:00
|
|
|
#undef INT_FAST16_MIN
|
2022-06-24 08:07:27 +03:00
|
|
|
#define INT_FAST16_MIN (-INT_FAST16_MAX - 1)
|
2023-04-25 22:01:40 +03:00
|
|
|
#undef INT_FAST32_MIN
|
2022-06-24 08:07:27 +03:00
|
|
|
#define INT_FAST32_MIN (-INT_FAST32_MAX - 1)
|
2023-04-25 22:01:40 +03:00
|
|
|
#undef INT_FAST64_MIN
|
2022-06-24 08:07:27 +03:00
|
|
|
#define INT_FAST64_MIN (-INT_FAST64_MAX - 1)
|
|
|
|
|
2023-04-25 22:01:40 +03:00
|
|
|
#ifdef __UINTPTR_MAX__
|
|
|
|
# undef UINTPTR_MAX
|
|
|
|
# define UINTPTR_MAX __UINTPTR_MAX__
|
|
|
|
#endif
|
|
|
|
#ifdef __INTPTR_MAX__
|
|
|
|
# undef INTPTR_MAX
|
|
|
|
# define INTPTR_MAX __INTPTR_MAX__
|
|
|
|
# undef INTPTR_MIN
|
|
|
|
# define INTPTR_MIN (-INTPTR_MAX - 1)
|
|
|
|
#endif
|
2022-02-15 07:46:37 +03:00
|
|
|
|
2023-04-25 22:01:40 +03:00
|
|
|
#undef UINTMAX_MAX
|
2022-02-15 07:46:37 +03:00
|
|
|
#define UINTMAX_MAX __UINTMAX_MAX__
|
2023-04-25 22:01:40 +03:00
|
|
|
#undef INTMAX_MAX
|
2022-02-15 07:46:37 +03:00
|
|
|
#define INTMAX_MAX __INTMAX_MAX__
|
2023-04-25 22:01:40 +03:00
|
|
|
#undef INTMAX_MIN
|
2022-02-15 07:46:37 +03:00
|
|
|
#define INTMAX_MIN (-INTMAX_MAX - 1)
|
|
|
|
|
2023-04-25 22:01:40 +03:00
|
|
|
#undef PTRDIFF_MAX
|
2022-02-15 07:46:37 +03:00
|
|
|
#define PTRDIFF_MAX __PTRDIFF_MAX__
|
2023-04-25 22:01:40 +03:00
|
|
|
#undef PTRDIFF_MIN
|
2022-02-15 07:46:37 +03:00
|
|
|
#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)
|
|
|
|
|
2023-04-25 22:01:40 +03:00
|
|
|
#undef SIG_ATOMIC_MAX
|
2022-06-24 08:07:27 +03:00
|
|
|
#define SIG_ATOMIC_MAX __SIG_ATOMIC_MAX__
|
2023-04-25 22:01:40 +03:00
|
|
|
#undef SIG_ATOMIC_MIN
|
2022-06-24 08:07:27 +03:00
|
|
|
#define SIG_ATOMIC_MIN (-SIG_ATOMIC_MAX - 1)
|
|
|
|
|
2023-04-25 22:01:40 +03:00
|
|
|
#undef SIZE_MAX
|
2022-02-15 07:46:37 +03:00
|
|
|
#define SIZE_MAX __SIZE_MAX__
|
|
|
|
|
2023-04-25 22:01:40 +03:00
|
|
|
#undef WCHAR_MAX
|
|
|
|
#define WCHAR_MAX __WCHAR_MAX__
|
|
|
|
#undef WCHAR_MIN
|
|
|
|
#define WCHAR_MIN (-WCHAR_MAX - 1)
|
2022-02-15 07:46:37 +03:00
|
|
|
|
2023-04-25 22:01:40 +03:00
|
|
|
#undef WINT_MAX
|
|
|
|
#define WINT_MAX __WINT_MAX__
|
|
|
|
#undef WINT_MIN
|
|
|
|
#define WINT_MIN (-WINT_MAX - 1)
|
2022-02-15 07:46:37 +03:00
|
|
|
|
|
|
|
#endif
|