Mercurial > repos > blastem
diff cpu_dsl.py @ 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 | 38c281ef57b0 |
children | 7e86ec94c899 |
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