Change add_or_fault macro

This commit is contained in:
Robin Salen 2023-05-01 09:49:43 +02:00
parent 1f39c555a9
commit 17a7c57d03
No known key found for this signature in database
GPG Key ID: F98FD38F65687358

View File

@ -313,14 +313,15 @@ global sys_basefee:
%jumpi(fault_exception)
%endmacro
// Adds the two top elements of the stack, and faults in case of overflow.
%macro add_or_fault
// stack: offset, size, kexit_info, offset, size
DUP1
%ensure_reasonable_offset
// stack: offset, size, kexit_info, offset, size
DUP2
// stack: size, offset, size, kexit_info, offset, size
%ensure_reasonable_offset
// stack: offset, size, kexit_info, offset, size
ADD
// stack: x, y
DUP2 ADD
// stack: sum, y
DUP1 SWAP2
// stack: y, sum, sum
GT
// stack: is_overflow, sum
%jumpi(fault_exception)
// stack: sum
%endmacro