From 4a5b869b0dcd1476395b8f45d07b45459f477c94 Mon Sep 17 00:00:00 2001 From: AJR Date: Sat, 29 Oct 2022 22:09:10 -0400 Subject: cpu/dsp32: Modify previous change, clamping before the narrowing conversion --- src/devices/cpu/dsp32/dsp32ops.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/devices/cpu/dsp32/dsp32ops.hxx b/src/devices/cpu/dsp32/dsp32ops.hxx index 1b8ab6b5951..10195d7adc3 100644 --- a/src/devices/cpu/dsp32/dsp32ops.hxx +++ b/src/devices/cpu/dsp32/dsp32ops.hxx @@ -2445,7 +2445,7 @@ void dsp32c_device::d5_int24(uint32_t op) int zpi = (op >> 0) & 0x7f; if (!(DAUC & 0x10)) val = floor(val + 0.5); else val = ceil(val - 0.5); - int32_t res = std::clamp(val, -0x800000, 0x7fffff); + int32_t res = int32_t(std::clamp(val, -0x800000, 0x7fffff)); if (zpi != 7) dau_write_pi_4bytes(zpi, res); dau_set_val_noflags((op >> 21) & 3, dsp_to_double(res << 8)); -- cgit v1.2.3