From 57033d0ef1810abf4edd9d8e57a95a5795e5a5a9 Mon Sep 17 00:00:00 2001 From: justanothercatgirl Date: Sat, 22 Jun 2024 18:16:54 +0300 Subject: added `rstypes` header. --- include/container.h | 4 +++- include/rstypes.h | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 include/rstypes.h (limited to 'include') diff --git a/include/container.h b/include/container.h index b987d35..47eb0a7 100644 --- a/include/container.h +++ b/include/container.h @@ -1,7 +1,6 @@ #ifndef JUSTANOTHERCATGIRL_HEADERS_CONTAINER #define JUSTANOTHERCATGIRL_HEADERS_CONTAINER -#include #include #include #include @@ -29,6 +28,7 @@ typedef unsigned char byte; unsigned long __bit_scan_32(int32_t number); unsigned long __bit_scan_64(int64_t number); #endif + #if defined(__clang__) || defined(__GNUC__) #define FALLTHROUGH __attribute__((fallthrough)) #elif defined(_MSC_VER) @@ -37,6 +37,8 @@ typedef unsigned char byte; #define FALLTHROUGH ((void)0) #endif +#define TODO (void)(*(volatile char*)0) + typedef int(*qsort_cmp_t)(const void*, const void*); #define get_qsort_cmp(type) __qsort_cmps[sizeof(type)] extern const qsort_cmp_t __qsort_cmps[64]; diff --git a/include/rstypes.h b/include/rstypes.h new file mode 100644 index 0000000..5af5ec5 --- /dev/null +++ b/include/rstypes.h @@ -0,0 +1,39 @@ +#ifndef JUSTANOTHERCATGITL_RSTYPES_H +#define JUSTANOTHERCATGITL_RSTYPES_H + +#include + +typedef uint8_t u8; +typedef int8_t i8; +typedef uint16_t u16; +typedef int16_t i16; +typedef uint32_t u32; +typedef int32_t i32; +typedef uint64_t u64; +typedef int64_t i64; + +typedef float f32; +typedef double f64; + + +#if defined(__SIZEOF_LONG_DOUBLE__) && __SIZEOF_LONG_DOUBLE__ == 128/8 +typedef long double f128; +#else // __SIZEOF_LONG_DOUBLE__ + #if defined(__clang__) || defined(__GNUC__) + typedef __float128 f128; + #else + #define f128 "128-bit floats are not supported on this platform/compiler" + #endif // __clang__ || __GNUC__ +#endif // __SIZEOF_LONG_DOUBLE__ + +#ifdef RS_TYPES_USE_128 + #if defined(__clang__) || defined(__GNUC__) + typedef __int128 i128; + typedef unsigned __int128 u128; + #else // __clang__ || __GNUC__ + #define i128 "128-bit integers are not supported in this compiler" + #define u128 "128-bit integers are not supported in this compiler" + #endif // __clang__ || __GNUC__ +#endif // RS_TYPES_USE_128 + +#endif // JUSTANOTHERCATGITL_RSTYPES_H -- cgit v1.2.3-70-g09d2