cleanup and comments

This commit is contained in:
Nicholas Ward 2022-09-14 11:35:28 -07:00
parent 5d7edb33d4
commit c11c526462
2 changed files with 9 additions and 8 deletions

View File

@ -3,7 +3,7 @@
// stack: x, y
ADD
// stack: x + y
%and_const(0xFFFFFFFF)
%truncate_to_u32
// stack: (x + y) & u32::MAX
%endmacro
@ -25,13 +25,7 @@
// stack: 32 - rot, value, value >> rot
SHL
// stack: value << (32 - rot), value >> rot
PUSH 32
PUSH 1
SWAP1
SHL
// stack: 1 << 32, value << (32 - rot), value >> rot
SWAP1
MOD
%truncate_to_u32
// stack: (value << (32 - rot)) % (1 << 32), value >> rot
ADD
%endmacro

View File

@ -1,11 +1,18 @@
// We put the message schedule in memory starting at 64 * num_blocks + 2.
%macro message_schedule_addr_from_num_blocks
// stack: num_blocks
%mul_const(64)
%add_const(2)
%endmacro
// We use memory starting at 320 * num_blocks + 2 (after the message schedule
// space) as scratch space to store stack values.
%macro scratch_space_addr_from_num_blocks
// stack: num_blocks
%mul_const(320)
%add_const(2)
%endmacro
%macro truncate_to_u32
%and_const(0xFFFFFFFF)
%endmacro