diff options
| author | dam <dam@gudinoff> | 2023-07-02 20:06:26 +0100 |
|---|---|---|
| committer | dam <dam@gudinoff> | 2023-07-02 20:06:26 +0100 |
| commit | d490fd25f4c7bd8988a4e4215a4dacceeebc36ee (patch) | |
| tree | d441441fb24bd111ef1197bcab6b9c2a76e2942a | |
| parent | 4d1a0ca8c06ee558a92c9981a572bb962f73a6f6 (diff) | |
| download | task-time-tracker-d490fd25f4c7bd8988a4e4215a4dacceeebc36ee.tar.zst task-time-tracker-d490fd25f4c7bd8988a4e4215a4dacceeebc36ee.zip | |
Removed is_signed function.
| -rw-r--r-- | Math_Ext.jai | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/Math_Ext.jai b/Math_Ext.jai index 368779f..a56b174 100644 --- a/Math_Ext.jai +++ b/Math_Ext.jai @@ -5,8 +5,6 @@ #import "Compiler"; #import "Math"; -is_signed :: ($t: Type) -> bool { return (cast(*Type_Info_Integer)type_info(t)).signed; } - INTEGER_ARITHMETIC_TYPES_CHECK :: #string DONE type_info_x := cast(*Type_Info)Tx; type_info_y := cast(*Type_Info)Ty; @@ -44,30 +42,29 @@ add :: (x: $Tx, y: $Ty, $USE_GENERIC: bool = false) -> result: $Tr, saturated: b #if USE_GENERIC || CPU != .X64 { - // #if #run is_signed(Tr) { // TODO Maybe use this? #if Tr == s8 || Tr == s16 || Tr == s32 || Tr == s64 { #if Tr == s8 { MAX :: S8_MAX; MIN :: S8_MIN; } #if Tr == s16 { MAX :: S16_MAX; MIN :: S16_MIN; } #if Tr == s32 { MAX :: S32_MAX; MIN :: S32_MIN; } #if Tr == s64 { MAX :: S64_MAX; MIN :: S64_MIN; } - + if (y > 0 && x > MAX - y) then return MAX, true; if (y < 0 && x < MIN - y) then return MIN, true; - + } else { #if Tr == u8 { MAX :: U8_MAX; } #if Tr == u16 { MAX :: U16_MAX; } #if Tr == u32 { MAX :: U32_MAX; } #if Tr == u64 { MAX :: U64_MAX; } - + if (x > MAX - y) then return MAX, true; - + } return x + y, false; - + } else { #import "String"; @@ -77,7 +74,7 @@ add :: (x: $Tx, y: $Ty, $USE_GENERIC: bool = false) -> result: $Tr, saturated: b S_ADD_ASM :: #string DONE #asm { - + // Performance // s8 | s16 | s32 | s64 // 1.243 | 1.242 | 1.215 | 1.210 @@ -147,7 +144,7 @@ sub :: (x: $Tx, y: $Ty, $USE_GENERIC: bool = false) -> result: $Tr, overflow: bo #if USE_GENERIC || CPU != .X64 { #if Tr == s8 || Tr == s16 || Tr == s32 || Tr == s64 { - + #if Tr == s8 { MAX :: S8_MAX; MIN :: S8_MIN; } #if Tr == s16 { MAX :: S16_MAX; MIN :: S16_MIN; } #if Tr == s32 { MAX :: S32_MAX; MIN :: S32_MIN; } @@ -226,8 +223,7 @@ mul :: (x: $Tx, y: $Ty, $USE_GENERIC: bool = false) -> result: $Tr, overflow: bo { #if USE_GENERIC || CPU != .X64 { - - // #if #run is_signed(Tr) { // TODO Maybe use this? + #if Tr == s8 || Tr == s16 || Tr == s32 || Tr == s64 { #if Tr == s8 { MAX :: S8_MAX; MIN :: S8_MIN; } @@ -332,7 +328,6 @@ div :: (x: $Tx, y: $Ty, $USE_GENERIC: bool = false) -> result: $Tr, remainder: T #if USE_GENERIC || CPU != .X64 { - // #if #run is_signed(Tr) { // TODO Maybe use this? #if Tr == s8 || Tr == s16 || Tr == s32 || Tr == s64 { #if Tr == s8 { MAX :: S8_MAX; MIN :: S8_MIN; } |
