mirror of https://github.com/flysand7/ciabatta.git
make thing compile with cl. TODO: stdatomic
This commit is contained in:
parent
3b4da3a797
commit
4bcbcbff50
|
@ -0,0 +1,4 @@
|
|||
|
||||
nasm src\_win\chkstk.asm -ochkstk.o -fwin64
|
||||
cl src\ciabatta.c -c -DCIABATTA_WIN -I inc -I src\_win /Z7 /showIncludes /arch:sse2
|
||||
lib /nologo /out:ciabatta.lib chkstk.o ciabatta.obj src\fdec64\fdec64.lib src\unicope\unicope.lib
|
|
@ -5,6 +5,10 @@
|
|||
#define __func__ __FUNCTION__
|
||||
#endif
|
||||
|
||||
#if defined (_MSC_VER)
|
||||
#define _Noreturn
|
||||
#endif
|
||||
|
||||
void _Noreturn _assert(
|
||||
char const *cond,
|
||||
char const *func,
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#if defined (_MSC_VER)
|
||||
#define _Thread_local __declspec(thread)
|
||||
#endif
|
||||
|
||||
#define EDOM 1
|
||||
#define EILSEQ 2
|
||||
#define ERANGE 3
|
||||
#define EIO 4
|
||||
|
||||
extern _Thread_local int errno;
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#define DECIMAL_DIG 10
|
||||
#define FLT_ROUNDS 1
|
||||
#define FLT_EVAL_METHOD 0
|
||||
|
||||
#define FLT_RADIX 2
|
||||
#define FLT_DECIMAL_DIG 6
|
||||
#define FLT_MIN 0x1.000000p-126
|
||||
#define FLT_MAX 0x1.7ffffep+127
|
||||
#define FLT_TRUE_MIN 0x1.000000p-149
|
||||
#define FLT_EPSILON 0x1.000002p+0
|
||||
#define FLT_MANT_DIG 23
|
||||
#define FLT_MIN_EXP -125
|
||||
#define FLT_MAX_EXP +128
|
||||
#define FLT_MIN_10_EXP -37
|
||||
#define FLT_MAX_10_EXP +38
|
||||
#define FLT_HAS_SUBNORM 1
|
||||
|
||||
#define DBL_DECIMAL_DIG 10
|
||||
#define DBL_MIN 0x1.0000000000000p-1021
|
||||
#define DBL_MAX 0x1.fffffffffffffp+1023
|
||||
#define DBL_TRUE_MIN 0x1.0000000000000p-1074
|
||||
#define DBL_EPSILON 0x1.0000000000001p+0
|
||||
#define DBL_MANT_DIG 11
|
||||
#define DBL_MIN_EXP -1022
|
||||
#define DBL_MAX_EXP +1024
|
||||
#define DBL_MIN_10_EXP -307
|
||||
#define DBL_MAX_10_EXP +308
|
||||
#define DBL_HAS_SUBNORM 1
|
||||
|
||||
#define LDBL_DECIMAL_DIG DBL_DECIMAL_DIG
|
||||
#define LDBL_MIN DBL_MIN
|
||||
#define LDBL_MAX DBL_MAX
|
||||
#define LDBL_TRUE_MIN DBL_TRUE_MIN
|
||||
#define LDBL_EPSILON DBL_EPSILON
|
||||
#define LDBL_MANT_DIG DBL_MANT_DIG
|
||||
#define LDBL_MIN_EXP DBL_MIN_EXP
|
||||
#define LDBL_MIN_10_EXP DBL_MIN_10_EXP
|
||||
#define LDBL_MAX_EXP DBL_MAX_EXP
|
||||
#define LDBL_MAX_10_EXP DBL_MAX_10_EXP
|
||||
#define LDBL_HAS_SUBNORM DBL_HAS_SUBNORM
|
399
inc/inttypes.h
399
inc/inttypes.h
|
@ -1,241 +1,176 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <limits.h>
|
||||
#include <wchar.h>
|
||||
|
||||
// typedef struct imaxdiv_t imaxdiv_t
|
||||
// It's C's fault not mine
|
||||
#define PRId8 "hhd"
|
||||
#define PRId16 "hd"
|
||||
#define PRId32 "d"
|
||||
#define PRId64 "lld"
|
||||
#define PRIdFAST8 "d"
|
||||
#define PRIdFAST16 "d"
|
||||
#define PRIdFAST32 "d"
|
||||
#define PRIdFAST64 "lld"
|
||||
#define PRIdLEAST8 "hhd"
|
||||
#define PRIdLEAST16 "hd"
|
||||
#define PRIdLEAST32 "d"
|
||||
#define PRIdLEAST64 "lld"
|
||||
#define PRIdPTR "lld"
|
||||
#define PRIdMAX "lld"
|
||||
#define PRIi8 "hhi"
|
||||
#define PRIi16 "hi"
|
||||
#define PRIi32 "i"
|
||||
#define PRIi64 "lli"
|
||||
#define PRIiFAST8 "i"
|
||||
#define PRIiFAST16 "i"
|
||||
#define PRIiFAST32 "i"
|
||||
#define PRIiFAST64 "lli"
|
||||
#define PRIiLEAST8 "hhi"
|
||||
#define PRIiLEAST16 "hi"
|
||||
#define PRIiLEAST32 "i"
|
||||
#define PRIiLEAST64 "lli"
|
||||
#define PRIiPTR "lli"
|
||||
#define PRIiMAX "lli"
|
||||
#define PRIo8 "hho"
|
||||
#define PRIo16 "ho"
|
||||
#define PRIo32 "o"
|
||||
#define PRIo64 "llo"
|
||||
#define PRIoLEAST8 "hho"
|
||||
#define PRIoLEAST16 "ho"
|
||||
#define PRIoLEAST32 "o"
|
||||
#define PRIoLEAST64 "llo"
|
||||
#define PRIoFAST8 "o"
|
||||
#define PRIoFAST16 "o"
|
||||
#define PRIoFAST32 "o"
|
||||
#define PRIoFAST64 "llo"
|
||||
#define PRIoPTR "llo"
|
||||
#define PRIoMAX "llo"
|
||||
#define PRIu8 "hhu"
|
||||
#define PRIu16 "hu"
|
||||
#define PRIu32 "u"
|
||||
#define PRIu64 "llu"
|
||||
#define PRIuLEAST8 "hhu"
|
||||
#define PRIuLEAST16 "hu"
|
||||
#define PRIuLEAST32 "u"
|
||||
#define PRIuLEAST64 "llu"
|
||||
#define PRIuFAST8 "u"
|
||||
#define PRIuFAST16 "u"
|
||||
#define PRIuFAST32 "u"
|
||||
#define PRIuFAST64 "llu"
|
||||
#define PRIuPTR "llu"
|
||||
#define PRIuMAX "llu"
|
||||
#define PRIx8 "hhx"
|
||||
#define PRIx16 "hx"
|
||||
#define PRIx32 "x"
|
||||
#define PRIx64 "llx"
|
||||
#define PRIxLEAST8 "hhx"
|
||||
#define PRIxLEAST16 "hx"
|
||||
#define PRIxLEAST32 "x"
|
||||
#define PRIxLEAST64 "llx"
|
||||
#define PRIxFAST8 "x"
|
||||
#define PRIxFAST16 "x"
|
||||
#define PRIxFAST32 "x"
|
||||
#define PRIxFAST64 "llx"
|
||||
#define PRIxPTR "llx"
|
||||
#define PRIxMAX "llx"
|
||||
#define PRIX8 "hhX"
|
||||
#define PRIX16 "hX"
|
||||
#define PRIX32 "X"
|
||||
#define PRIX64 "llX"
|
||||
#define PRIXLEAST8 "hhX"
|
||||
#define PRIXLEAST16 "hX"
|
||||
#define PRIXLEAST32 "X"
|
||||
#define PRIXLEAST64 "llX"
|
||||
#define PRIXFAST8 "X"
|
||||
#define PRIXFAST16 "X"
|
||||
#define PRIXFAST32 "X"
|
||||
#define PRIXFAST64 "llX"
|
||||
#define PRIXPTR "llX"
|
||||
#define PRIXMAX "llX"
|
||||
|
||||
#define _spec8 "hh"
|
||||
#define _spec16 ""
|
||||
#define _spec32 ""
|
||||
#define SCNd8 "hhd"
|
||||
#define SCNd16 "hd"
|
||||
#define SCNd32 "d"
|
||||
#define SCNd64 "lld"
|
||||
#define SCNdFAST8 "d"
|
||||
#define SCNdFAST16 "d"
|
||||
#define SCNdFAST32 "d"
|
||||
#define SCNdFAST64 "lld"
|
||||
#define SCNdLEAST8 "hhd"
|
||||
#define SCNdLEAST16 "hd"
|
||||
#define SCNdLEAST32 "d"
|
||||
#define SCNdLEAST64 "lld"
|
||||
#define SCNdPTR "lld"
|
||||
#define SCNdMAX "lld"
|
||||
#define SCNi8 "hhi"
|
||||
#define SCNi16 "hi"
|
||||
#define SCNi32 "i"
|
||||
#define SCNi64 "lli"
|
||||
#define SCNiFAST8 "i"
|
||||
#define SCNiFAST16 "i"
|
||||
#define SCNiFAST32 "i"
|
||||
#define SCNiFAST64 "lli"
|
||||
#define SCNiLEAST8 "hhi"
|
||||
#define SCNiLEAST16 "hi"
|
||||
#define SCNiLEAST32 "i"
|
||||
#define SCNiLEAST64 "lli"
|
||||
#define SCNiPTR "lli"
|
||||
#define SCNiMAX "lli"
|
||||
#define SCNo8 "hho"
|
||||
#define SCNo16 "ho"
|
||||
#define SCNo32 "o"
|
||||
#define SCNo64 "llo"
|
||||
#define SCNoLEAST8 "hho"
|
||||
#define SCNoLEAST16 "ho"
|
||||
#define SCNoLEAST32 "o"
|
||||
#define SCNoLEAST64 "llo"
|
||||
#define SCNoFAST8 "o"
|
||||
#define SCNoFAST16 "o"
|
||||
#define SCNoFAST32 "o"
|
||||
#define SCNoFAST64 "llo"
|
||||
#define SCNoPTR "llo"
|
||||
#define SCNoMAX "llo"
|
||||
#define SCNu8 "hhu"
|
||||
#define SCNu16 "hu"
|
||||
#define SCNu32 "u"
|
||||
#define SCNu64 "llu"
|
||||
#define SCNuLEAST8 "hhu"
|
||||
#define SCNuLEAST16 "hu"
|
||||
#define SCNuLEAST32 "u"
|
||||
#define SCNuLEAST64 "llu"
|
||||
#define SCNuFAST8 "u"
|
||||
#define SCNuFAST16 "u"
|
||||
#define SCNuFAST32 "u"
|
||||
#define SCNuFAST64 "llu"
|
||||
#define SCNuPTR "llu"
|
||||
#define SCNuMAX "llu"
|
||||
#define SCNx8 "hhx"
|
||||
#define SCNx16 "hx"
|
||||
#define SCNx32 "x"
|
||||
#define SCNx64 "llx"
|
||||
#define SCNxLEAST8 "hhx"
|
||||
#define SCNxLEAST16 "hx"
|
||||
#define SCNxLEAST32 "x"
|
||||
#define SCNxLEAST64 "llx"
|
||||
#define SCNxFAST8 "x"
|
||||
#define SCNxFAST16 "x"
|
||||
#define SCNxFAST32 "x"
|
||||
#define SCNxFAST64 "llx"
|
||||
#define SCNxPTR "llx"
|
||||
#define SCNxMAX "llx"
|
||||
|
||||
#if INT64_MAX == LONG_MAX
|
||||
#define _spec64 "l"
|
||||
#elif INT64_MAX == LLONG_MAX
|
||||
#define _spec64 "ll"
|
||||
#endif
|
||||
typedef struct imaxdiv_t imaxdiv_t;
|
||||
struct imaxdiv_t {
|
||||
intmax_t quot;
|
||||
intmax_t rem;
|
||||
};
|
||||
|
||||
#if INT8_LEAST_MAX == CHAR_MAX
|
||||
#define _spec8l "hh"
|
||||
#elif INT8_LEAST_MAX == SHORT_MAX || INT8_LEAST_MAX==INT_MAX
|
||||
#define _spec8l ""
|
||||
#elif INT8_LEAST_MAX == LONG_MAX
|
||||
#define _spec8l "l"
|
||||
#elif INT8_LEAST_MAX == LLONG_MAX
|
||||
#define _spec8l "ll"
|
||||
#endif
|
||||
intmax_t imaxabs(intmax_t j);
|
||||
imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
|
||||
intmax_t strtoimax(const char *restrict s, char **restrict end, int base);
|
||||
uintmax_t strtoumax(const char *restrict s, char ** restrict end, int base);
|
||||
intmax_t wcstoimax(const wchar_t *restrict s, wchar_t **restrict end, int base);
|
||||
uintmax_t wcstoumax(const wchar_t *restrict s, wchar_t **restrict end, int base);
|
||||
|
||||
#if INT16_LEAST_MAX == SHORT_MAX || INT16_LEAST_MAX==INT_MAX
|
||||
#define _spec16l ""
|
||||
#elif INT16_LEAST_MAX == LONG_MAX
|
||||
#define _spec16l "l"
|
||||
#elif INT16_LEAST_MAX == LLONG_MAX
|
||||
#define _spec16l "ll"
|
||||
#endif
|
||||
|
||||
#if INT32_LEAST_MAX==INT_MAX
|
||||
#define _spec32l ""
|
||||
#elif INT32_LEAST_MAX == LONG_MAX
|
||||
#define _spec32l "l"
|
||||
#elif INT32_LEAST_MAX == LLONG_MAX
|
||||
#define _spec32l "ll"
|
||||
#endif
|
||||
|
||||
#if INT64_LEAST_MAX == LONG_MAX
|
||||
#define _spec64l "l"
|
||||
#elif INT64_LEAST_MAX == LLONG_MAX
|
||||
#define _spec64l "ll"
|
||||
#endif
|
||||
|
||||
|
||||
#if INT8_FAST_MAX == CHAR_MAX
|
||||
#define _spec8f "hh"
|
||||
#elif INT8_FAST_MAX == SHORT_MAX || INT8_FAST_MAX==INT_MAX
|
||||
#define _spec8f ""
|
||||
#elif INT8_FAST_MAX == LONG_MAX
|
||||
#define _spec8f "l"
|
||||
#elif INT8_FAST_MAX == LLONG_MAX
|
||||
#define _spec8f "ll"
|
||||
#endif
|
||||
|
||||
#if INT16_FAST_MAX == SHORT_MAX || INT16_FAST_MAX==INT_MAX
|
||||
#define _spec16f ""
|
||||
#elif INT16_FAST_MAX == LONG_MAX
|
||||
#define _spec16f "l"
|
||||
#elif INT16_FAST_MAX == LLONG_MAX
|
||||
#define _spec16f "ll"
|
||||
#endif
|
||||
|
||||
#if INT32_FAST_MAX==INT_MAX
|
||||
#define _spec32f ""
|
||||
#elif INT32_FAST_MAX == LONG_MAX
|
||||
#define _spec32f "l"
|
||||
#elif INT32_FAST_MAX == LLONG_MAX
|
||||
#define _spec32f "ll"
|
||||
#endif
|
||||
|
||||
#if INT64_FAST_MAX == LONG_MAX
|
||||
#define _spec64f "l"
|
||||
#elif INT64_FAST_MAX == LLONG_MAX
|
||||
#define _spec64f "ll"
|
||||
#endif
|
||||
|
||||
#define _specmax "j"
|
||||
|
||||
#define PRId8 _spec8 "d"
|
||||
#define PRId16 _spec16 "d"
|
||||
#define PRId32 _spec32 "d"
|
||||
#define PRId64 _spec64 "d"
|
||||
#define PRIdFAST8 _spec8f "d"
|
||||
#define PRIdFAST16 _spec16f "d"
|
||||
#define PRIdFAST32 _spec32f "d"
|
||||
#define PRIdFAST64 _spec64f "d"
|
||||
#define PRIdLEAST8 _spec8l "d"
|
||||
#define PRIdLEAST16 _spec16l "d"
|
||||
#define PRIdLEAST32 _spec32l "d"
|
||||
#define PRIdLEAST64 _spec64l "d"
|
||||
#define PRIdPTR _specptr "d"
|
||||
#define PRIdMAX _specmax "d"
|
||||
#define PRIi8 _spec8 "i"
|
||||
#define PRIi16 _spec16 "i"
|
||||
#define PRIi32 _spec32 "i"
|
||||
#define PRIi64 _spec64 "i"
|
||||
#define PRIiFAST8 _spec8f "i"
|
||||
#define PRIiFAST16 _spec16f "i"
|
||||
#define PRIiFAST32 _spec32f "i"
|
||||
#define PRIiFAST64 _spec64f "i"
|
||||
#define PRIiLEAST8 _spec8l "i"
|
||||
#define PRIiLEAST16 _spec16l "i"
|
||||
#define PRIiLEAST32 _spec32l "i"
|
||||
#define PRIiLEAST64 _spec64l "i"
|
||||
#define PRIiPTR _specptr "i"
|
||||
#define PRIiMAX _specmax "i"
|
||||
#define PRIo8 _spec8 "o"
|
||||
#define PRIo16 _spec16 "o"
|
||||
#define PRIo32 _spec16 "o"
|
||||
#define PRIo64 _spec64 "o"
|
||||
#define PRIoLEAST8 _spec8l "o"
|
||||
#define PRIoLEAST16 _spec16l "o"
|
||||
#define PRIoLEAST32 _spec32l "o"
|
||||
#define PRIoLEAST64 _spec64l "o"
|
||||
#define PRIoFAST8 _spec8f "o"
|
||||
#define PRIoFAST16 _spec16f "o"
|
||||
#define PRIoFAST32 _spec32f "o"
|
||||
#define PRIoFAST64 _spec64f "o"
|
||||
#define PRIoPTR _specptr "o"
|
||||
#define PRIoMAX _specmax "o"
|
||||
#define PRIu8 _spec8 "u"
|
||||
#define PRIu16 _spec16 "u"
|
||||
#define PRIu32 _spec16 "u"
|
||||
#define PRIu64 _spec64 "u"
|
||||
#define PRIuLEAST8 _spec8l "u"
|
||||
#define PRIuLEAST16 _spec16l "u"
|
||||
#define PRIuLEAST32 _spec32l "u"
|
||||
#define PRIuLEAST64 _spec64l "u"
|
||||
#define PRIuFAST8 _spec8f "u"
|
||||
#define PRIuFAST16 _spec16f "u"
|
||||
#define PRIuFAST32 _spec32f "u"
|
||||
#define PRIuFAST64 _spec64f "u"
|
||||
#define PRIuPTR _specptr "u"
|
||||
#define PRIuMAX _specmax "u"
|
||||
#define PRIx8 _spec8 "x"
|
||||
#define PRIx16 _spec16 "x"
|
||||
#define PRIx32 _spec32 "x"
|
||||
#define PRIx64 _spec64 "x"
|
||||
#define PRIxLEAST8 _spec8l "x"
|
||||
#define PRIxLEAST16 _spec16l "x"
|
||||
#define PRIxLEAST32 _spec32l "x"
|
||||
#define PRIxLEAST64 _spec64l "x"
|
||||
#define PRIxFAST8 _spec8f "x"
|
||||
#define PRIxFAST16 _spec16f "x"
|
||||
#define PRIxFAST32 _spec32f "x"
|
||||
#define PRIxFAST64 _spec64f "x"
|
||||
#define PRIxPTR _specptr "x"
|
||||
#define PRIxMAX _specmax "x"
|
||||
#define PRIX8 _spec8 "X"
|
||||
#define PRIX16 _spec16 "X"
|
||||
#define PRIX32 _spec32 "X"
|
||||
#define PRIX64 _spec64 "X"
|
||||
#define PRIXLEAST8 _spec8l "X"
|
||||
#define PRIXLEAST16 _spec16l "X"
|
||||
#define PRIXLEAST32 _spec32l "X"
|
||||
#define PRIXLEAST64 _spec64l "X"
|
||||
#define PRIXFAST8 _spec8f "X"
|
||||
#define PRIXFAST16 _spec16f "X"
|
||||
#define PRIXFAST32 _spec32f "X"
|
||||
#define PRIXFAST64 _spec64f "X"
|
||||
#define PRIXPTR _specptr "X"
|
||||
#define PRIXMAX _specmax "X"
|
||||
|
||||
#define SCNd8 _spec8 "d"
|
||||
#define SCNd16 _spec16 "d"
|
||||
#define SCNd32 _spec32 "d"
|
||||
#define SCNd64 _spec64 "d"
|
||||
#define SCNdFAST8 _spec8f "d"
|
||||
#define SCNdFAST16 _spec16f "d"
|
||||
#define SCNdFAST32 _spec32f "d"
|
||||
#define SCNdFAST64 _spec64f "d"
|
||||
#define SCNdLEAST8 _spec8l "d"
|
||||
#define SCNdLEAST16 _spec16l "d"
|
||||
#define SCNdLEAST32 _spec32l "d"
|
||||
#define SCNdLEAST64 _spec64l "d"
|
||||
#define SCNdPTR _specptr "d"
|
||||
#define SCNdMAX _specmax "d"
|
||||
#define SCNi8 _spec8 "i"
|
||||
#define SCNi16 _spec16 "i"
|
||||
#define SCNi32 _spec32 "i"
|
||||
#define SCNi64 _spec64 "i"
|
||||
#define SCNiFAST8 _spec8f "i"
|
||||
#define SCNiFAST16 _spec16f "i"
|
||||
#define SCNiFAST32 _spec32f "i"
|
||||
#define SCNiFAST64 _spec64f "i"
|
||||
#define SCNiLEAST8 _spec8l "i"
|
||||
#define SCNiLEAST16 _spec16l "i"
|
||||
#define SCNiLEAST32 _spec32l "i"
|
||||
#define SCNiLEAST64 _spec64l "i"
|
||||
#define SCNiPTR _specptr "i"
|
||||
#define SCNiMAX _specmax "i"
|
||||
#define SCNo8 _spec8 "o"
|
||||
#define SCNo16 _spec16 "o"
|
||||
#define SCNo32 _spec16 "o"
|
||||
#define SCNo64 _spec64 "o"
|
||||
#define SCNoLEAST8 _spec8l "o"
|
||||
#define SCNoLEAST16 _spec16l "o"
|
||||
#define SCNoLEAST32 _spec32l "o"
|
||||
#define SCNoLEAST64 _spec64l "o"
|
||||
#define SCNoFAST8 _spec8f "o"
|
||||
#define SCNoFAST16 _spec16f "o"
|
||||
#define SCNoFAST32 _spec32f "o"
|
||||
#define SCNoFAST64 _spec64f "o"
|
||||
#define SCNoPTR _specptr "o"
|
||||
#define SCNoMAX _specmax "o"
|
||||
#define SCNu8 _spec8 "u"
|
||||
#define SCNu16 _spec16 "u"
|
||||
#define SCNu32 _spec16 "u"
|
||||
#define SCNu64 _spec64 "u"
|
||||
#define SCNuLEAST8 _spec8l "u"
|
||||
#define SCNuLEAST16 _spec16l "u"
|
||||
#define SCNuLEAST32 _spec32l "u"
|
||||
#define SCNuLEAST64 _spec64l "u"
|
||||
#define SCNuFAST8 _spec8f "u"
|
||||
#define SCNuFAST16 _spec16f "u"
|
||||
#define SCNuFAST32 _spec32f "u"
|
||||
#define SCNuFAST64 _spec64f "u"
|
||||
#define SCNuPTR _specptr "u"
|
||||
#define SCNuMAX _specmax "u"
|
||||
#define SCNx8 _spec8 "x"
|
||||
#define SCNx16 _spec16 "x"
|
||||
#define SCNx32 _spec32 "x"
|
||||
#define SCNx64 _spec64 "x"
|
||||
#define SCNxLEAST8 _spec8l "x"
|
||||
#define SCNxLEAST16 _spec16l "x"
|
||||
#define SCNxLEAST32 _spec32l "x"
|
||||
#define SCNxLEAST64 _spec64l "x"
|
||||
#define SCNxFAST8 _spec8f "x"
|
||||
#define SCNxFAST16 _spec16f "x"
|
||||
#define SCNxFAST32 _spec32f "x"
|
||||
#define SCNxFAST64 _spec64f "x"
|
||||
#define SCNxPTR _specptr "x"
|
||||
#define SCNxMAX _specmax "x"
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#define and &&
|
||||
#define and_eq &=
|
||||
#define bitand &
|
||||
#define bitor |
|
||||
#define compl ~
|
||||
#define not !
|
||||
#define not_eq !=
|
||||
#define or ||
|
||||
#define or_eq |=
|
||||
#define xor ^
|
||||
#define xor_eq ^=
|
|
@ -0,0 +1,86 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#define _ILP32 0
|
||||
#define _LLP64 1
|
||||
#define _LP64 2
|
||||
#define _ILP64 3
|
||||
#define _SILP64 4
|
||||
|
||||
#if defined(__linux__)
|
||||
#define _DATA_MODEL _LP64
|
||||
#elif defined(_WIN64)
|
||||
#define _DATA_MODEL _LLP64
|
||||
#else
|
||||
#error "Could not determine target OS"
|
||||
#endif
|
||||
|
||||
#define MB_LEN_MAX 5
|
||||
|
||||
#define CHAR_BIT 8
|
||||
#define BOOL_WIDTH 8
|
||||
|
||||
#define UCHAR_WIDTH 8
|
||||
#define SCHAR_WIDTH 8
|
||||
#define UCHAR_MAX 0xff
|
||||
#define SCHAR_MIN -0x80
|
||||
#define SCHAR_MAX +0x7f
|
||||
|
||||
#if defined(__CHAR_UNSIGNED__) || defined(_CHAR_UNSIGNED)
|
||||
#define CHAR_MIN UCHAR_MIN
|
||||
#define CHAR_MAX UCHAR_MAX
|
||||
#else
|
||||
#define CHAR_MIN SCHAR_MIN
|
||||
#define CHAR_MAX SCHAR_MAX
|
||||
#endif
|
||||
|
||||
#define USHRT_WIDTH 16
|
||||
#define SHRT_WIDTH 16
|
||||
#define USHRT_MAX 0xffff
|
||||
#define SHRT_MIN -0x8000
|
||||
#define SHRT_MAX +0x7fff
|
||||
|
||||
#define UINT_WIDTH 32
|
||||
#define INT_WIDTH 32
|
||||
#define UINT_MAX 0xffffffffu
|
||||
#define INT_MIN -0x80000000
|
||||
#define INT_MAX +0x7fffffff
|
||||
|
||||
#if _DATA_MODEL == _LP64
|
||||
#define ULONG_WIDTH 64
|
||||
#define LONG_WIDTH 64
|
||||
#define ULONG_MAX 0xffffffffffffffffull
|
||||
#define LONG_MIN -0x8000000000000000ll
|
||||
#define LONG_MAX +0x7fffffffffffffffll
|
||||
#elif _DATA_MODEL == _LLP64
|
||||
#define ULONG_WIDTH 32
|
||||
#define LONG_WIDTH 32
|
||||
#define ULONG_MAX +0xffffffff
|
||||
#define LONG_MIN -0x80000000
|
||||
#define LONG_MAX +0x7fffffff
|
||||
#endif
|
||||
|
||||
#define ULLONG_WIDTH 64
|
||||
#define LLONG_WIDTH 64
|
||||
#define ULLONG_MAX 0xffffffffffffffffull
|
||||
#define LLONG_MIN -0x8000000000000000ll
|
||||
#define LLONG_MAX +0x7fffffffffffffffll
|
||||
|
||||
#define PTRDIFF_WIDTH LLONG_WIDTH
|
||||
#define PTRDIFF_MIN LLONG_MIN
|
||||
#define PTRDIFF_MAX LLONG_MAX
|
||||
|
||||
#define SIZE_WIDTH ULLONG_WIDTH
|
||||
#define SIZE_MAX ULLONG_MAX
|
||||
|
||||
#define SIG_ATOMIC_WIDTH LLONG_WIDTH
|
||||
#define SIG_ATOMIC_MIN LLONG_MIN
|
||||
#define SIG_ATOMIC_MAX LLONG_MAX
|
||||
|
||||
#define WINT_WIDTH INT_WIDTH
|
||||
#define WINT_MIN INT_MIN
|
||||
#define WINT_MAX INT_MAX
|
||||
|
||||
#define WCHAR_WIDTH USHORT_WIDTH
|
||||
#define WCHAR_MIN USHORT_WIDTH
|
||||
#define WCHAR_MAX USHORT_WIDTH
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
enum memory_order {
|
||||
memory_order_relaxed,
|
||||
memory_order_consume,
|
||||
memory_order_acquire,
|
||||
memory_order_release,
|
||||
memory_order_acq_rel,
|
||||
memory_order_seq_cst
|
||||
};
|
||||
|
||||
typedef int atomic_int;
|
|
@ -0,0 +1,27 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#define __bool_true_false_are_defined 1
|
||||
#define __alignas_is_defined 1
|
||||
#define __alignof_is_defined 1
|
||||
|
||||
#define NULL ((void *)0)
|
||||
#define offsetof(st, m) ((size_t)((char *)&((st *)0)->m - (char *)0))
|
||||
|
||||
typedef unsigned long long size_t;
|
||||
typedef long long ptrdiff_t;
|
||||
typedef long long max_align_t;
|
||||
typedef unsigned short wchar_t; //
|
||||
|
||||
#define bool _Bool
|
||||
#define true 1
|
||||
#define false 0
|
||||
|
||||
#define alignas _Alignas
|
||||
#define alignof _Alignof
|
||||
|
||||
#if !defined(_MSC_VER)
|
||||
#define noreturn _Noreturn
|
||||
#else
|
||||
#define noreturn declspec(noreturn)
|
||||
#endif
|
|
@ -0,0 +1,132 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
typedef signed 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 int8_t int_least8_t;
|
||||
typedef int16_t int_least16_t;
|
||||
typedef int32_t int_least32_t;
|
||||
typedef int64_t int_least64_t;
|
||||
typedef uint8_t uint_least8_t;
|
||||
typedef uint16_t uint_least16_t;
|
||||
typedef uint32_t uint_least32_t;
|
||||
typedef uint64_t uint_least64_t;
|
||||
|
||||
typedef int32_t int_fast8_t;
|
||||
typedef int32_t int_fast16_t;
|
||||
typedef int32_t int_fast32_t;
|
||||
typedef int64_t int_fast64_t;
|
||||
typedef uint32_t uint_fast8_t;
|
||||
typedef uint32_t uint_fast16_t;
|
||||
typedef uint32_t uint_fast32_t;
|
||||
typedef uint64_t uint_fast64_t;
|
||||
|
||||
typedef int64_t intptr_t;
|
||||
typedef uint64_t uintptr_t;
|
||||
|
||||
typedef int64_t intmax_t;
|
||||
typedef uint64_t uintmax_t;
|
||||
|
||||
#define INT8_WIDTH 8
|
||||
#define INT16_WIDTH 16
|
||||
#define INT32_WIDTH 32
|
||||
#define INT64_WIDTH 64
|
||||
|
||||
#define UINT8_WIDTH 8
|
||||
#define UINT16_WIDTH 16
|
||||
#define UINT32_WIDTH 32
|
||||
#define UINT64_WIDTH 64
|
||||
|
||||
#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 +0x7fffffffffffffff
|
||||
|
||||
#define UINT8_MAX +0xff
|
||||
#define UINT16_MAX +0xffff
|
||||
#define UINT32_MAX +0xffffffffu
|
||||
#define UINT64_MAX +0xffffffffffffffffull
|
||||
|
||||
#define INT_LEAST8_WIDTH INT8_WIDTH
|
||||
#define INT_LEAST16_WIDTH INT16_WIDTH
|
||||
#define INT_LEAST32_WIDTH INT32_WIDTH
|
||||
#define INT_LEAST64_WIDTH INT64_WIDTH
|
||||
|
||||
#define UINT_LEAST8_WIDTH INT8_WIDTH
|
||||
#define UINT_LEAST16_WIDTH INT16_WIDTH
|
||||
#define UINT_LEAST32_WIDTH INT32_WIDTH
|
||||
#define UINT_LEAST64_WIDTH INT64_WIDTH
|
||||
|
||||
#define INT_LEAST8_MIN INT8_MIN
|
||||
#define INT_LEAST16_MIN INT16_MIN
|
||||
#define INT_LEAST32_MIN INT32_MIN
|
||||
#define INT_LEAST64_MIN INT64_MIN
|
||||
|
||||
#define INT_LEAST8_MAX INT8_MAX
|
||||
#define INT_LEAST16_MAX INT16_MAX
|
||||
#define INT_LEAST32_MAX INT32_MAX
|
||||
#define INT_LEAST64_MAX INT64_MAX
|
||||
|
||||
#define UINT_LEAST8_MAX UINT8_MAX
|
||||
#define UINT_LEAST16_MAX UINT16_MAX
|
||||
#define UINT_LEAST32_MAX UINT32_MAX
|
||||
#define UINT_LEAST64_MAX UINT64_MAX
|
||||
|
||||
#define INT_FAST8_WIDTH INT32_WIDTH
|
||||
#define INT_FAST16_WIDTH INT32_WIDTH
|
||||
#define INT_FAST32_WIDTH INT32_WIDTH
|
||||
#define INT_FAST64_WIDTH INT64_WIDTH
|
||||
|
||||
#define UINT_FAST8_WIDTH INT32_WIDTH
|
||||
#define UINT_FAST16_WIDTH INT32_WIDTH
|
||||
#define UINT_FAST32_WIDTH INT32_WIDTH
|
||||
#define UINT_FAST64_WIDTH INT64_WIDTH
|
||||
|
||||
#define INT_FAST8_MIN INT32_MIN
|
||||
#define INT_FAST16_MIN INT32_MIN
|
||||
#define INT_FAST32_MIN INT32_MIN
|
||||
#define INT_FAST64_MIN INT64_MIN
|
||||
|
||||
#define INT_FAST8_MAX INT32_MAX
|
||||
#define INT_FAST16_MAX INT32_MAX
|
||||
#define INT_FAST32_MAX INT32_MAX
|
||||
#define INT_FAST64_MAX INT64_MAX
|
||||
|
||||
#define UINT_FAST8_MAX UINT32_MAX
|
||||
#define UINT_FAST16_MAX UINT32_MAX
|
||||
#define UINT_FAST32_MAX UINT32_MAX
|
||||
#define UINT_FAST64_MAX UINT64_MAX
|
||||
|
||||
#define INTPTR_WIDTH INT64_WIDTH
|
||||
#define UINTPTR_WIDTH UINT64_WIDTH
|
||||
#define INTPTR_MIN INT64_MIN
|
||||
#define INTPTR_MAX INT64_MAX
|
||||
#define UINTPTR_MAX UINT64_MAX
|
||||
|
||||
#define INTMAX_WIDTH INT64_WIDTH
|
||||
#define UINTMAX_WIDTH UINT64_WIDTH
|
||||
#define INTMAX_MIN INT64_MIN
|
||||
#define INTMAX_MAX INT64_MAX
|
||||
#define UINTMAX_MAX UINT64_MAX
|
||||
|
||||
#define INT8_C(lit) lit
|
||||
#define INT16_C(lit) lit
|
||||
#define INT32_C(lit) lit
|
||||
#define INT64_C(lit) lit ## ll
|
||||
|
||||
#define UINT8_C(lit) lit
|
||||
#define UINT16_C(lit) lit
|
||||
#define UINT32_C(lit) lit
|
||||
#define UINT64_C(lit) lit ## ull
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <stdarg.h>
|
||||
|
|
|
@ -4,7 +4,12 @@
|
|||
#include <stdbool.h>
|
||||
#include <stdatomic.h>
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define _Thread_local __declspec(thread)
|
||||
#endif
|
||||
|
||||
#define thread_local _Thread_local
|
||||
|
||||
#define ONCE_FLAG_INIT 1
|
||||
#define TSS_DTOR_ITERATIONS 32
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
typedef struct mbstate_t mbstate_t;
|
||||
struct mbstate_t {
|
||||
union {
|
||||
char16_t leftover;
|
||||
char16_t high_surrogate;
|
||||
unsigned short leftover;
|
||||
unsigned short high_surrogate;
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
typedef unsigned long long size_t;
|
||||
#else
|
||||
typedef unsigned long size_t;
|
||||
#endif
|
|
@ -1,14 +1,14 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <types/mbstate.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
typedef uint_least16_t char16_t;
|
||||
typedef uint_least32_t char32_t;
|
||||
|
||||
#include "_mbstate.h"
|
||||
|
||||
size_t mbrtoc16(
|
||||
char16_t *restrict pc16,
|
||||
char const *restrict s,
|
||||
|
|
11
inc/wchar.h
11
inc/wchar.h
|
@ -1,14 +1,17 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <types/mbstate.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <limits.h>
|
||||
|
||||
typedef int wint_t;
|
||||
|
||||
#include "_mbstate.h"
|
||||
|
||||
#define WCHAR_MIN 0x0000
|
||||
#define WCHAR_MAX 0xffff
|
||||
// #define WCHAR_MIN 0x0000
|
||||
// #define WCHAR_MAX 0xffff
|
||||
|
||||
#ifndef WEOF
|
||||
#define WEOF -1
|
||||
|
|
|
@ -42,11 +42,20 @@ void mainCRTStartup() {
|
|||
}
|
||||
|
||||
|
||||
_Noreturn void _Exit(int status) {
|
||||
ExitProcess(status);
|
||||
#if defined(_MSC_VER)
|
||||
__assume(0);
|
||||
#elif defined(__GNUC__)
|
||||
__builtin_unreachable();
|
||||
#endif
|
||||
}
|
||||
|
||||
_Noreturn void quick_exit(int status) {
|
||||
while(atqexit_func_count--) {
|
||||
atqexit_funcs[atqexit_func_count]();
|
||||
}
|
||||
ExitProcess(status);
|
||||
_Exit(status);
|
||||
}
|
||||
|
||||
_Noreturn void exit(int status) {
|
||||
|
@ -54,16 +63,12 @@ _Noreturn void exit(int status) {
|
|||
atexit_funcs[atqexit_func_count]();
|
||||
}
|
||||
_close_io();
|
||||
ExitProcess(status);
|
||||
}
|
||||
|
||||
_Noreturn void _Exit(int status) {
|
||||
ExitProcess(status);
|
||||
_Exit(status);
|
||||
}
|
||||
|
||||
_Noreturn void abort(void) {
|
||||
raise(SIGABRT);
|
||||
ExitProcess(-69);
|
||||
_Exit(-69);
|
||||
}
|
||||
|
||||
int atexit(void (*func)(void)) {
|
||||
|
@ -126,7 +131,7 @@ int system(const char* string) {
|
|||
.hStdError = GetStdHandle(STD_ERROR_HANDLE),
|
||||
.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE)
|
||||
};
|
||||
PROCESS_INFORMATION pi = {};
|
||||
PROCESS_INFORMATION pi = {0};
|
||||
|
||||
if (!CreateProcessW(NULL, cmd_line, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi)) {
|
||||
goto error;
|
||||
|
|
|
@ -130,8 +130,8 @@ void _setup_io() {
|
|||
|
||||
int win_parse_mode(
|
||||
char const *mode,
|
||||
int *pio_mode,
|
||||
int *pbt_mode,
|
||||
stream_io_mode_t *pio_mode,
|
||||
stream_bt_mode_t *pbt_mode,
|
||||
DWORD *paccess,
|
||||
DWORD *pshare,
|
||||
DWORD *pdisp
|
||||
|
|
|
@ -23,7 +23,9 @@
|
|||
|
||||
// Intrinsics
|
||||
#if !defined(__FMA__)
|
||||
#if !defined(_MSC_VER)
|
||||
#error "Get a better CPU (the kind that supports FMA) or enable -mfma"
|
||||
#endif
|
||||
#endif
|
||||
// xmmintrin.h depends on mm_malloc.h, which itself includes other CRT headers
|
||||
// Which introduces compiler errors. Actually does it really matter? I would
|
||||
|
|
|
@ -209,7 +209,6 @@ char *strerror(int errnum) {
|
|||
case EDOM: return "Value is out of domain of the function";
|
||||
case EILSEQ: return "Illegal byte sequence";
|
||||
case ERANGE: return "Value is out of range";
|
||||
case EIO: return "I/O error";
|
||||
}
|
||||
return "Unkown error";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue