mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-21 23:23:13 +00:00
reverse bytes via BYTE code
This commit is contained in:
parent
abff978826
commit
d6b3522b34
@ -22,9 +22,9 @@ store_size:
|
||||
// stack: ab
|
||||
%extract_and_store_byte(70)
|
||||
// stack: a
|
||||
%mstore_ripemd_offset(71)
|
||||
%mstore_ripemd(71)
|
||||
// stack: 0x80 // padding has 0x80 in first position and zeros elsewhere
|
||||
%mstore_ripemd_offset(72) // store first padding term here so as to avoid extra label
|
||||
%mstore_ripemd(72) // store first padding term here so as to avoid extra label
|
||||
%jump(store_padding)
|
||||
|
||||
store_padding:
|
||||
@ -107,11 +107,11 @@ store_input:
|
||||
DIV
|
||||
SWAP1
|
||||
// stack: y, xs
|
||||
%mstore_ripemd_offset($offset)
|
||||
%mstore_ripemd($offset)
|
||||
// stack: xs
|
||||
%endmacro
|
||||
|
||||
%macro mstore_ripemd_offset(offset)
|
||||
%macro mstore_ripemd(offset)
|
||||
// stack: value
|
||||
PUSH $offset
|
||||
// stack: offset, value
|
||||
|
||||
@ -255,39 +255,26 @@
|
||||
%macro reverse_bytes_u32
|
||||
// stack: abcd
|
||||
DUP1
|
||||
%and_const(0xFF)
|
||||
// stack: d, abcd
|
||||
%stack (d, abcd) -> (abcd, d, 0x100, d)
|
||||
// stack: abcd, d, 0x100, d
|
||||
SUB
|
||||
DIV
|
||||
// stack: abc, d
|
||||
DUP1
|
||||
%and_const(0xFF)
|
||||
// stack: c, abc, d
|
||||
%stack (c, abc) -> (abc, c, 0x100, c)
|
||||
// stack: abc, c, 0x100, c, d
|
||||
SUB
|
||||
DIV
|
||||
// stack: ab, c, d
|
||||
DUP1
|
||||
%and_const(0xFF)
|
||||
// stack: b, ab, c, d
|
||||
%stack (b, ab) -> (ab, b, 0x100, b)
|
||||
// stack: ab, b, 0x100, b, c, d
|
||||
SUB
|
||||
DIV
|
||||
// stack: a, b, c, d
|
||||
SWAP1
|
||||
PUSH 28
|
||||
BYTE
|
||||
// stack: a, abcd
|
||||
DUP2
|
||||
PUSH 29
|
||||
BYTE
|
||||
%shl_const(8)
|
||||
OR
|
||||
// stack: ba, c, d
|
||||
SWAP1
|
||||
// stack: b0, a, abcd
|
||||
DUP3
|
||||
PUSH 30
|
||||
BYTE
|
||||
%shl_const(16)
|
||||
OR
|
||||
// stack: cba, d
|
||||
SWAP1
|
||||
// stack: c00, b0, a, abcd
|
||||
SWAP3
|
||||
PUSH 31
|
||||
BYTE
|
||||
%shl_const(24)
|
||||
// stack: d000, b0, a, c00
|
||||
OR
|
||||
OR
|
||||
OR
|
||||
// stack: dcba
|
||||
%endmacro
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user