aboutsummaryrefslogtreecommitdiff
path: root/Math_Ext.jai
diff options
context:
space:
mode:
authordam <dam@gudinoff>2023-06-08 01:27:07 +0100
committerdam <dam@gudinoff>2023-06-08 01:27:07 +0100
commit2f758a4e5bcf6c125a5f81155675ccabbde8aeb5 (patch)
treede28eb049b749aea66117af618ca3d15b2447cbf /Math_Ext.jai
parent1502bb4d94f742069fa14d5ce5cb21761c5a44ed (diff)
downloadtask-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.jai7
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;