mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-07 16:23:12 +00:00
Handle empty case for memcpy_bytes
This commit is contained in:
parent
8af189b927
commit
83054b0ffe
@ -57,6 +57,17 @@ memcpy_finish:
|
|||||||
// Similar logic to memcpy, but optimized for copying sequences of bytes.
|
// Similar logic to memcpy, but optimized for copying sequences of bytes.
|
||||||
global memcpy_bytes:
|
global memcpy_bytes:
|
||||||
// stack: DST, SRC, count, retdest
|
// 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_bytes_empty)
|
||||||
|
|
||||||
|
// stack: DST, SRC, count, retdest
|
||||||
|
|
||||||
|
// Handle small case
|
||||||
DUP7
|
DUP7
|
||||||
// stack: count, DST, SRC, count, retdest
|
// stack: count, DST, SRC, count, retdest
|
||||||
%lt_const(0x20)
|
%lt_const(0x20)
|
||||||
@ -119,6 +130,12 @@ memcpy_bytes_finish:
|
|||||||
// stack: retdest
|
// stack: retdest
|
||||||
JUMP
|
JUMP
|
||||||
|
|
||||||
|
memcpy_bytes_empty:
|
||||||
|
// stack: DST, SRC, count, retdest
|
||||||
|
%pop7
|
||||||
|
// stack: retdest
|
||||||
|
JUMP
|
||||||
|
|
||||||
%macro memcpy_bytes
|
%macro memcpy_bytes
|
||||||
%stack (dst: 3, src: 3, count) -> (dst, src, count, %%after)
|
%stack (dst: 3, src: 3, count) -> (dst, src, count, %%after)
|
||||||
%jump(memcpy_bytes)
|
%jump(memcpy_bytes)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user