From c96a8700afa8fd67feb1a48eaada9a2bc54ca52b Mon Sep 17 00:00:00 2001 From: Robin Salen Date: Mon, 30 Oct 2023 08:18:47 -0400 Subject: [PATCH] Move empty check inside final iteration --- evm/src/cpu/kernel/asm/memory/memcpy.asm | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/evm/src/cpu/kernel/asm/memory/memcpy.asm b/evm/src/cpu/kernel/asm/memory/memcpy.asm index 55b773eb17..99532dcb1b 100644 --- a/evm/src/cpu/kernel/asm/memory/memcpy.asm +++ b/evm/src/cpu/kernel/asm/memory/memcpy.asm @@ -52,15 +52,6 @@ global memcpy: global memcpy_bytes: // stack: DST, SRC, count, retdest - // Handle empty case - DUP7 - // stack: count, DST, SRC, count, retdest - ISZERO - // stack: count == 0, DST, SRC, count, retdest - %jumpi(memcpy_finish) - - // stack: DST, SRC, count, retdest - // Handle small case DUP7 // stack: count, DST, SRC, count, retdest @@ -104,6 +95,15 @@ global memcpy_bytes: memcpy_bytes_finish: // stack: DST, SRC, count, retdest + // Handle empty case + DUP7 + // stack: count, DST, SRC, count, retdest + ISZERO + // stack: count == 0, DST, SRC, count, retdest + %jumpi(memcpy_finish) + + // stack: DST, SRC, count, retdest + // Copy the last chunk of `count` bytes. DUP7 DUP1