mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-03 14:23:07 +00:00
min, max macros
Will be used later for things like updating `MemorySize`.
This commit is contained in:
parent
002b568a12
commit
f58990160e
@ -140,6 +140,11 @@
|
||||
// stack: input >= c, ...
|
||||
%endmacro
|
||||
|
||||
%macro consume_gas_const(c)
|
||||
PUSH $c
|
||||
CONSUME_GAS
|
||||
%endmacro
|
||||
|
||||
// If pred is zero, yields z; otherwise, yields nz
|
||||
%macro select
|
||||
// stack: pred, nz, z
|
||||
@ -188,3 +193,25 @@
|
||||
mul
|
||||
// stack: x^2
|
||||
%endmacro
|
||||
|
||||
%macro min
|
||||
// stack: x, y
|
||||
DUP2
|
||||
DUP2
|
||||
// stack: x, y, x, y
|
||||
LT
|
||||
// stack: x < y, x, y
|
||||
%select_bool
|
||||
// stack: min
|
||||
%endmacro
|
||||
|
||||
%macro max
|
||||
// stack: x, y
|
||||
DUP2
|
||||
DUP2
|
||||
// stack: x, y, x, y
|
||||
GT
|
||||
// stack: x > y, x, y
|
||||
%select_bool
|
||||
// stack: max
|
||||
%endmacro
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user