aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Math_Ext.jai3
1 files changed, 2 insertions, 1 deletions
diff --git a/Math_Ext.jai b/Math_Ext.jai
index 8f7531b..dd553cd 100644
--- a/Math_Ext.jai
+++ b/Math_Ext.jai
@@ -230,6 +230,7 @@ mul :: (x: $Tx, y: $Ty, $USE_GENERIC: bool = false) -> result: $Tr, overflow: bo
#if Tr == u32 { MAX :: U32_MAX; }
#if Tr == u64 { MAX :: U64_MAX; }
+ if x == 0 || y == 0 then return 0, false;
if x > MAX / y then return MAX, true;
}
@@ -422,7 +423,7 @@ div :: (x: $Tx, y: $Ty, $USE_GENERIC: bool = false) -> result: $Tr, remainder: T
remainder === d;
mov saturated, 0;
- mov result, x;
+ movzxbw result, x; // Move zero-extended byte to word.
div.SIZE result, y;
// Extract remainder from result's high bits.