Skip to content

Commit b137851

Browse files
committed
Fix signed division in moddbx
1 parent 14e3782 commit b137851

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kos/src/kernel/moddbx/cexpr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3048,7 +3048,7 @@ PUBLIC dbx_errno_t NOTHROW(FCALL cexpr_op2)(unsigned int op) {
30483048
if unlikely(!rhs_value)
30493049
return DBX_EDIVZERO;
30503050
if (is_signed) {
3051-
lhs_value = (uintmax_t)((intmax_t)lhs_value / rhs_value);
3051+
lhs_value = (uintmax_t)((intmax_t)lhs_value / (intmax_t)rhs_value);
30523052
} else {
30533053
lhs_value /= rhs_value;
30543054
}
@@ -3060,7 +3060,7 @@ PUBLIC dbx_errno_t NOTHROW(FCALL cexpr_op2)(unsigned int op) {
30603060
if unlikely(!rhs_value)
30613061
return DBX_EDIVZERO;
30623062
if (is_signed) {
3063-
lhs_value = (uintmax_t)((intmax_t)lhs_value % rhs_value);
3063+
lhs_value = (uintmax_t)((intmax_t)lhs_value % (intmax_t)rhs_value);
30643064
} else {
30653065
lhs_value %= rhs_value;
30663066
}

0 commit comments

Comments
 (0)