div instead of shr

This commit is contained in:
Nicholas Ward 2023-03-16 11:56:39 -07:00
parent f518a8b4bd
commit 9534762179
3 changed files with 9 additions and 9 deletions

View File

@ -31,7 +31,7 @@ global sha2_pad:
DUP1
// stack: num_bytes, num_bytes, retdest
%add_const(8)
%shr_const(6)
%div_const(64)
%increment
// stack: num_blocks = (num_bytes+8)//64 + 1, num_bytes, retdest

View File

@ -34,7 +34,7 @@
// stack: rotr(x, 18), x, rotr(x, 7)
SWAP1
// stack: x, rotr(x, 18), rotr(x, 7)
%shr_const(3)
%div_const(8) // equivalent to %shr_const(3)
// stack: shr(x, 3), rotr(x, 18), rotr(x, 7)
XOR
XOR

View File

@ -15,7 +15,7 @@
%decrement
SWAP1
// stack: length, last_addr - 1
%shr_const(8)
%div_const(256) // equivalent to %shr_const(8)
// stack: length >> 8, last_addr - 1
DUP1
// stack: length >> 8, length >> 8, last_addr - 1
@ -30,7 +30,7 @@
%decrement
SWAP1
// stack: length >> 8, last_addr - 2
%shr_const(8)
%div_const(256) // equivalent to %shr_const(8)
// stack: length >> 16, last_addr - 2
DUP1
// stack: length >> 16, length >> 16, last_addr - 2
@ -45,7 +45,7 @@
%decrement
SWAP1
// stack: length >> 16, last_addr - 3
%shr_const(8)
%div_const(256) // equivalent to %shr_const(8)
// stack: length >> 24, last_addr - 3
DUP1
// stack: length >> 24, length >> 24, last_addr - 3
@ -60,7 +60,7 @@
%decrement
SWAP1
// stack: length >> 24, last_addr - 4
%shr_const(8)
%div_const(256) // equivalent to %shr_const(8)
// stack: length >> 32, last_addr - 4
DUP1
// stack: length >> 32, length >> 32, last_addr - 4
@ -75,7 +75,7 @@
%decrement
SWAP1
// stack: length >> 32, last_addr - 5
%shr_const(8)
%div_const(256) // equivalent to %shr_const(8)
// stack: length >> 40, last_addr - 5
DUP1
// stack: length >> 40, length >> 40, last_addr - 5
@ -90,7 +90,7 @@
%decrement
SWAP1
// stack: length >> 40, last_addr - 6
%shr_const(8)
%div_const(256) // equivalent to %shr_const(8)
// stack: length >> 48, last_addr - 6
DUP1
// stack: length >> 48, length >> 48, last_addr - 6
@ -105,7 +105,7 @@
%decrement
SWAP1
// stack: length >> 48, last_addr - 7
%shr_const(8)
%div_const(256) // equivalent to %shr_const(8)
// stack: length >> 56, last_addr - 7
DUP1
// stack: length >> 56, length >> 56, last_addr - 7