Skip to content

Commit

Permalink
🚧 make proper script for u254
Browse files Browse the repository at this point in the history
  • Loading branch information
ZamDimon committed Oct 24, 2024
1 parent d3db967 commit b3063b7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions bitcoin-testscripts/src/friendly/u254.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ impl<const W: usize, const S: usize> SplitableScript for FriendlyU254MulScript<W
// Convert to w-width form.
{ U254Windowed::OP_TOBEWINDOWEDFORM_TOALTSTACK() }

// Extend to larger integer
{ U254Windowed::OP_EXTEND::<U508>() }

// Precomputing {0*z, 1*z, ..., ((1<<WIDTH)-1)*z}
{ WindowedPrecomputeTable::<U508, W, false>::initialize() }

Expand All @@ -44,7 +47,7 @@ impl<const W: usize, const S: usize> SplitableScript for FriendlyU254MulScript<W
for _ in 1..U254Windowed::DECOMPOSITION_SIZE {
// Double the result WIDTH times
for _ in 0..W {
{ U508::OP_2MUL(0) }
{ U508::OP_2MUL_NOOVERFLOW(0) }
}

// Picking di from the stack
Expand All @@ -59,7 +62,7 @@ impl<const W: usize, const S: usize> SplitableScript for FriendlyU254MulScript<W
OP_SWAP
OP_SUB
{ U508::OP_PICKSTACK() }
{ U508::OP_ADD(0, 1) }
{ U508::OP_ADD_NOOVERFLOW(0, 1) }
}

// Clearing the precomputed values from the stack.
Expand Down

0 comments on commit b3063b7

Please sign in to comment.