Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

last fixes pre-modexp #361

Merged
merged 4 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions main/modexp/array_lib/array_div_two.zkasm
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ VAR GLOBAL array_div_two_RR
array_div_two:
; w.c. is when len(in) >> len(2)

%MAX_CNT_BINARY - CNT_BINARY - 2 :JMPN(outOfCountersBinary)
%MAX_CNT_STEPS - STEP - 20 - 4*%ARRAY_MAX_LEN_MINUS_ONE - 3 :JMPN(outOfCountersStep) ; till array_mul_two
%MAX_CNT_BINARY - CNT_BINARY - 3 :JMPN(outOfCountersBinary)
%MAX_CNT_STEPS - STEP - 26 - 4*%ARRAY_MAX_LEN_MINUS_ONE - 1 :JMPN(outOfCountersStep) ; till array_mul_two

RR :MSTORE(array_div_two_RR)

Expand All @@ -39,7 +39,6 @@ array_div_two:
C - 1 :JMPNZ(array_div_two_inAGTinB) ; If len(in) > 1, then we already know that in > 2
$ => A :MLOAD(array_div_two_in); Here, len(in) = 1
$ :EQ, JMPC(array_div_two_inALTinB)
__array_div_two_inA_continue:
; Here, len(in) = 1

; 2] Check if in = 2, in < 2 or in > 2
Expand Down Expand Up @@ -114,6 +113,7 @@ array_div_two_inAGTinB:
A :MSTORE(array_div_two_quo + RR)
A :MSTORE(array_mul_two_in + RR)
RR - 1 => RR :JMPN(array_div_two_mul_quo_inB)
; w.c. [steps: 26, bin: 3]

array_div_two_quo_to_mul:
${receiveQuotientChunk_short(RR)} => A
Expand All @@ -125,8 +125,8 @@ array_div_two_mul_quo_inB:
:CALL(array_mul_two)

; w.c. is when rem is not zero
%MAX_CNT_BINARY - CNT_BINARY - 2 :JMPN(outOfCountersBinary)
%MAX_CNT_STEPS - STEP - 10 - 3*%ARRAY_MAX_LEN_MINUS_ONE - 1 :JMPN(outOfCountersStep) ; till array_add_short
%MAX_CNT_BINARY - CNT_BINARY - 2 :JMPN(outOfCountersBinary)
%MAX_CNT_STEPS - STEP - 9 - 3*%ARRAY_MAX_LEN_MINUS_ONE - 1 :JMPN(outOfCountersStep) ; till array_add_short

; Check the remainder
${receiveRemainderChunk_short()} => A
Expand Down
4 changes: 2 additions & 2 deletions main/modexp/array_lib/array_mul_two.zkasm
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ VAR GLOBAL array_mul_two_carry
VAR GLOBAL array_mul_two_RR

array_mul_two:
%MAX_CNT_BINARY - CNT_BINARY - 1 - 2*%ARRAY_MAX_LEN_MINUS_ONE - 2 :JMPN(outOfCountersBinary)
%MAX_CNT_STEPS - STEP - 10 - 11*%ARRAY_MAX_LEN_MINUS_ONE - 2 - 8 - 5*%ARRAY_MAX_LEN_DOUBLED_MINUS_ONE - 3 :JMPN(outOfCountersStep)
%MAX_CNT_BINARY - CNT_BINARY - 1 - 2*%ARRAY_MAX_LEN_MINUS_ONE :JMPN(outOfCountersBinary)
%MAX_CNT_STEPS - STEP - 9 - 11*%ARRAY_MAX_LEN_MINUS_ONE - 7 :JMPN(outOfCountersStep)

RR :MSTORE(array_mul_two_RR)

Expand Down
100 changes: 0 additions & 100 deletions main/modexp/array_lib/unused/array_add.zkasm

This file was deleted.

82 changes: 0 additions & 82 deletions main/modexp/array_lib/unused/array_compare.zkasm

This file was deleted.

Loading