1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 08:49:37 +00:00

Tweak more overtly to avoid divide by zero.

This commit is contained in:
Thomas Harte 2022-05-29 20:51:50 -04:00
parent 9eea471e72
commit 7788a109b0

View File

@ -522,7 +522,8 @@ template <
#define DIV(Type16, Type32, flow_function) { \
status.carry_flag = 0; \
\
if(!src.w) { \
const auto divisor = Type32(Type16(src.w)); \
if(!divisor) { \
status.negative_flag = status.overflow_flag = 0; \
status.zero_result = 1; \
flow_controller.raise_exception(Exception::IntegerDivideByZero); \
@ -530,7 +531,6 @@ template <
} \
\
const auto dividend = Type32(dest.l); \
const auto divisor = Type32(Type16(src.w)); \
const auto quotient = dividend / divisor; \
\
if(quotient != Type32(Type16(quotient))) { \