diff options
| author | dam <dam@gudinoff> | 2023-06-08 01:27:07 +0100 |
|---|---|---|
| committer | dam <dam@gudinoff> | 2023-06-08 01:27:07 +0100 |
| commit | 2f758a4e5bcf6c125a5f81155675ccabbde8aeb5 (patch) | |
| tree | de28eb049b749aea66117af618ca3d15b2447cbf /Math_Ext.jai | |
| parent | 1502bb4d94f742069fa14d5ce5cb21761c5a44ed (diff) | |
| download | task-time-tracker-2f758a4e5bcf6c125a5f81155675ccabbde8aeb5.tar.zst task-time-tracker-2f758a4e5bcf6c125a5f81155675ccabbde8aeb5.zip | |
Fixed bug on mul. Added performance tests.
Diffstat (limited to 'Math_Ext.jai')
| -rw-r--r-- | Math_Ext.jai | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Math_Ext.jai b/Math_Ext.jai index 9ec34d0..ad41c2f 100644 --- a/Math_Ext.jai +++ b/Math_Ext.jai @@ -225,6 +225,11 @@ mul :: (x: $Tx, y: $Ty, $USE_GENERIC: bool = false) -> result: $Tr, overflow: bo } 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; } @@ -297,7 +302,7 @@ mul :: (x: $Tx, y: $Ty, $USE_GENERIC: bool = false) -> result: $Tr, overflow: bo #insert #run replace(U_MUL_ASM, ".SIZE", ".d"); #if Tr == u64 #insert #run replace(U_MUL_ASM, ".SIZE", ".q"); - + return result, saturated; |
