Merge pull request #1316 from topos-protocol/memcpy_tiny

Move empty check inside final iteration of memcpy_bytes
This commit is contained in:
Robin Salen 2023-10-30 14:12:18 -04:00 committed by GitHub
commit 0f299d4c2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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