diff options
| author | 2022-10-29 22:09:10 -0400 | |
|---|---|---|
| committer | 2022-10-29 22:09:10 -0400 | |
| commit | 4a5b869b0dcd1476395b8f45d07b45459f477c94 (patch) | |
| tree | fab0c56ac6b944e9f3df18cc0d4f886f682c945f | |
| parent | 9e98def219d4635926fad9f1354f97b22d618ec8 (diff) | |
cpu/dsp32: Modify previous change, clamping before the narrowing conversion
| -rw-r--r-- | src/devices/cpu/dsp32/dsp32ops.hxx | 2 |
1 files changed, 1 insertions, 1 deletions
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<int32_t>(val, -0x800000, 0x7fffff); + int32_t res = int32_t(std::clamp<double>(val, -0x800000, 0x7fffff)); if (zpi != 7) dau_write_pi_4bytes(zpi, res); dau_set_val_noflags((op >> 21) & 3, dsp_to_double(res << 8)); |
