diff options
author | A404M <ahmadmahmoudiprogrammer@gmail.com> | 2025-04-08 07:36:47 +0330 |
---|---|---|
committer | A404M <ahmadmahmoudiprogrammer@gmail.com> | 2025-04-08 07:36:47 +0330 |
commit | 65f7f06d010e705d70f47db48b371f81d09914ea (patch) | |
tree | 93bc674142eb91ec603a8c3b33e690828fb1b1de /src/utils | |
parent | c2939352858f8471fb69ae629948a259552231bc (diff) |
add support for tcc
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/log.h | 6 | ||||
-rw-r--r-- | src/utils/type.c | 5 | ||||
-rw-r--r-- | src/utils/type.h | 12 |
3 files changed, 22 insertions, 1 deletions
diff --git a/src/utils/log.h b/src/utils/log.h index 510170f..eb9034f 100644 --- a/src/utils/log.h +++ b/src/utils/log.h @@ -1,5 +1,11 @@ #pragma once +#include "utils/type.h" + +#ifndef __FILE_NAME__ +#define __FILE_NAME__ __FILE__ +#endif + #define printLog(format,...) _printLogBack(format, __FILE_NAME__, __LINE__, ## __VA_ARGS__) #define printError(begin,end,format,...) _printErrorWarningBack(__FILE_NAME__, __LINE__, begin, end, true, format, ## __VA_ARGS__) #define printWarning(begin,end,format,...) _printErrorWarningBack(__FILE_NAME__, __LINE__, begin, end, false, format, ## __VA_ARGS__) diff --git a/src/utils/type.c b/src/utils/type.c index dea08ef..a46be5a 100644 --- a/src/utils/type.c +++ b/src/utils/type.c @@ -3,6 +3,8 @@ #include <assert.h> void checkTypes() { + assert(sizeof(bool) == (8 / 8)); + assert(sizeof(i8) == (8 / 8)); assert(sizeof(i16) == (16 / 8)); assert(sizeof(i32) == (32 / 8)); @@ -13,9 +15,10 @@ void checkTypes() { assert(sizeof(u32) == (32 / 8)); assert(sizeof(u64) == (64 / 8)); +#ifdef FLOAT_16_SUPPORT assert(sizeof(f16) == (16 / 8)); +#endif assert(sizeof(f32) == (32 / 8)); assert(sizeof(f64) == (64 / 8)); assert(sizeof(f128) == (128 / 8)); } - diff --git a/src/utils/type.h b/src/utils/type.h index aad46df..771837e 100644 --- a/src/utils/type.h +++ b/src/utils/type.h @@ -2,6 +2,8 @@ #include <stdint.h> +// #define FLOAT_16_SUPPORT + typedef int8_t i8; typedef int16_t i16; typedef int32_t i32; @@ -12,9 +14,19 @@ typedef uint16_t u16; typedef uint32_t u32; typedef uint64_t u64; +#ifdef FLOAT_16_SUPPORT typedef _Float16 f16; +#endif typedef float f32; typedef double f64; typedef long double f128; +#ifndef __cplusplus +#if (__STDC_VERSION__ < 202000L) +typedef u8 bool; +#define false (bool)0 +#define true (bool)1 +#endif +#endif + void checkTypes(); |