Mercurial > repos > blastem
changeset 2672:6894a25ebfaa
Fix mulu nflag when compiling with optimization enabled
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 08 Mar 2025 20:20:23 -0800 |
parents | e0935d5878c3 |
children | 2c8f541af3c5 |
files | cpu_dsl.py |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/cpu_dsl.py Sat Mar 08 19:57:23 2025 -0800 +++ b/cpu_dsl.py Sat Mar 08 20:20:23 2025 -0800 @@ -883,7 +883,9 @@ if p1Size >= size: p1Size = size // 2 #TODO: Handle case in which destSize > size - return f'\n\t{params[2]} = ((uint{p0Size}_t){params[0]}) * ((uint{p1Size}_t){params[1]});' + p0Mask = (1 << p0Size) - 1 + p1Mask = (1 << p1Size) - 1 + return f'\n\t{params[2]} = ((uint{size}_t)({params[0]} & {p0Mask})) * ((uint{size}_t)({params[1]} & {p1Mask}));' def _getCarryCheck(prog): carryFlag = None