pub enum CoreHint {
Show 28 variants AllocSegment { dst: CellRef, }, TestLessThan { lhs: ResOperand, rhs: ResOperand, dst: CellRef, }, TestLessThanOrEqual { lhs: ResOperand, rhs: ResOperand, dst: CellRef, }, WideMul128 { lhs: ResOperand, rhs: ResOperand, high: CellRef, low: CellRef, }, DivMod { lhs: ResOperand, rhs: ResOperand, quotient: CellRef, remainder: CellRef, }, Uint256DivMod { dividend0: ResOperand, dividend1: ResOperand, divisor0: ResOperand, divisor1: ResOperand, quotient0: CellRef, quotient1: CellRef, remainder0: CellRef, remainder1: CellRef, }, Uint512DivModByUint256 { dividend0: ResOperand, dividend1: ResOperand, dividend2: ResOperand, dividend3: ResOperand, divisor0: ResOperand, divisor1: ResOperand, quotient0: CellRef, quotient1: CellRef, quotient2: CellRef, quotient3: CellRef, remainder0: CellRef, remainder1: CellRef, }, SquareRoot { value: ResOperand, dst: CellRef, }, Uint256SquareRoot { value_low: ResOperand, value_high: ResOperand, sqrt0: CellRef, sqrt1: CellRef, remainder_low: CellRef, remainder_high: CellRef, sqrt_mul_2_minus_remainder_ge_u128: CellRef, }, LinearSplit { value: ResOperand, scalar: ResOperand, max_x: ResOperand, x: CellRef, y: CellRef, }, AllocFelt252Dict { segment_arena_ptr: ResOperand, }, Felt252DictEntryInit { dict_ptr: ResOperand, key: ResOperand, }, Felt252DictEntryUpdate { dict_ptr: ResOperand, value: ResOperand, }, GetSegmentArenaIndex { dict_end_ptr: ResOperand, dict_index: CellRef, }, InitSquashData { dict_accesses: ResOperand, ptr_diff: ResOperand, n_accesses: ResOperand, big_keys: CellRef, first_key: CellRef, }, GetCurrentAccessIndex { range_check_ptr: ResOperand, }, ShouldSkipSquashLoop { should_skip_loop: CellRef, }, GetCurrentAccessDelta { index_delta_minus1: CellRef, }, ShouldContinueSquashLoop { should_continue: CellRef, }, GetNextDictKey { next_key: CellRef, }, AssertLeFindSmallArcs { range_check_ptr: ResOperand, a: ResOperand, b: ResOperand, }, AssertLeIsFirstArcExcluded { skip_exclude_a_flag: CellRef, }, AssertLeIsSecondArcExcluded { skip_exclude_b_minus_a: CellRef, }, RandomEcPoint { x: CellRef, y: CellRef, }, FieldSqrt { val: ResOperand, sqrt: CellRef, }, DebugPrint { start: ResOperand, end: ResOperand, }, AllocConstantSize { size: ResOperand, dst: CellRef, }, U256InvModN { b0: ResOperand, b1: ResOperand, n0: ResOperand, n1: ResOperand, g0_or_no_inv: CellRef, g1_option: CellRef, s_or_r0: CellRef, s_or_r1: CellRef, t_or_k0: CellRef, t_or_k1: CellRef, },
}

Variants§

§

AllocSegment

Fields

§

TestLessThan

§

TestLessThanOrEqual

§

WideMul128

Multiplies two 128-bit integers and returns two 128-bit integers: the high and low parts of the product.

§

DivMod

Fields

§quotient: CellRef
§remainder: CellRef

Computes lhs/rhs and returns the quotient and remainder.

Note: the hint may be used to write an already assigned memory cell.

§

Uint256DivMod

Fields

§dividend0: ResOperand
§dividend1: ResOperand
§divisor0: ResOperand
§divisor1: ResOperand
§quotient0: CellRef
§quotient1: CellRef
§remainder0: CellRef
§remainder1: CellRef

Divides dividend (represented by 2 128bit limbs) by divisor (represented by 2 128bit limbs). Returns the quotient (represented by 2 128bit limbs) and remainder (represented by 2 128bit limbs). In all cases - name0 is the least significant limb.

§

Uint512DivModByUint256

Fields

§dividend0: ResOperand
§dividend1: ResOperand
§dividend2: ResOperand
§dividend3: ResOperand
§divisor0: ResOperand
§divisor1: ResOperand
§quotient0: CellRef
§quotient1: CellRef
§quotient2: CellRef
§quotient3: CellRef
§remainder0: CellRef
§remainder1: CellRef

Divides dividend (represented by 4 128bit limbs) by divisor (represented by 2 128bit limbs). Returns the quotient (represented by 4 128bit limbs) and remainder (represented by 2 128bit limbs). In all cases - name0 is the least significant limb.

§

SquareRoot

Fields

§

Uint256SquareRoot

Fields

§value_low: ResOperand
§value_high: ResOperand
§sqrt0: CellRef
§sqrt1: CellRef
§remainder_low: CellRef
§remainder_high: CellRef
§sqrt_mul_2_minus_remainder_ge_u128: CellRef

Computes the square root of value_low<<128+value_high, stores the 64bit limbs of the result in sqrt0 and sqrt1 as well as the 128bit limbs of the remainder in remainder_low and remainder_high. The remainder is defined as value - sqrt**2. Lastly it checks weather 2*sqrt - remainder >= 2**128.

§

LinearSplit

Finds some x and y such that x * scalar + y = value and x <= max_x.

§

AllocFelt252Dict

Fields

§segment_arena_ptr: ResOperand

Allocates a new dict segment, and write its start address into the dict_infos segment.

§

Felt252DictEntryInit

Fields

§dict_ptr: ResOperand

Fetch the previous value of a key in a dict, and write it in a new dict access.

§

Felt252DictEntryUpdate

Fields

§dict_ptr: ResOperand

Similar to Felt252DictWrite, but updates an existing entry and does not write the previous value to the stack.

§

GetSegmentArenaIndex

Fields

§dict_end_ptr: ResOperand
§dict_index: CellRef

Retrieves the index of the given dict in the dict_infos segment.

§

InitSquashData

Fields

§dict_accesses: ResOperand
§ptr_diff: ResOperand
§n_accesses: ResOperand
§big_keys: CellRef
§first_key: CellRef

Initialized the lists of accesses of each key of a dict as a preparation of squash_dict.

§

GetCurrentAccessIndex

Fields

§range_check_ptr: ResOperand

Retrieves the current index of a dict access to process.

§

ShouldSkipSquashLoop

Fields

§should_skip_loop: CellRef

Writes if the squash_dict loop should be skipped.

§

GetCurrentAccessDelta

Fields

§index_delta_minus1: CellRef

Writes the delta from the current access index to the next one.

§

ShouldContinueSquashLoop

Fields

§should_continue: CellRef

Writes if the squash_dict loop should be continued.

§

GetNextDictKey

Fields

§next_key: CellRef

Writes the next dict key to process.

§

AssertLeFindSmallArcs

Fields

§range_check_ptr: ResOperand

Finds the two small arcs from within [(0,a),(a,b),(b,PRIME)] and writes it to the range_check segment.

§

AssertLeIsFirstArcExcluded

Fields

§skip_exclude_a_flag: CellRef

Writes if the arc (0,a) was excluded.

§

AssertLeIsSecondArcExcluded

Fields

§skip_exclude_b_minus_a: CellRef

Writes if the arc (a,b) was excluded.

§

RandomEcPoint

Fields

Samples a random point on the EC.

§

FieldSqrt

Fields

§sqrt: CellRef

Computes the square root of val, if val is a quadratic residue, and of 3 * val otherwise.

Since 3 is not a quadratic residue, exactly one of val and 3 * val is a quadratic residue (unless val is 0). This allows proving that val is not a quadratic residue.

§

DebugPrint

Fields

Prints the values from start to end. Both must be pointers.

§

AllocConstantSize

Fields

Returns an address with size free locations afterwards.

§

U256InvModN

Fields

§g0_or_no_inv: CellRef
§g1_option: CellRef
§s_or_r0: CellRef
§s_or_r1: CellRef
§t_or_k0: CellRef
§t_or_k1: CellRef

Provides the inverse of b (represented by 2 128-bit limbs) modulo n (represented by 2 128-bit limbs), or a proof that b has no inverse.

In case b has an inverse: Returns r and k such that:

  • r = 1 / b (mod n)
  • k = (r * b - 1) / n
  • g0_or_no_inv = 0

In case b has no inverse: Returns g, s, and t, such that: g > 1 g == 2 || g % 2 == 1 (in particular, g0_or_no_inv = g0 != 0) g * s = b g * t = n

The case n == 1 is considered “no-inverse” (special case). In this case: Returns g == 1, s == b and t == 1. All no-inverse requirements are satisfied, except for g > 1.

In all cases - name0 is the least significant limb.

Trait Implementations§

source§

impl Clone for CoreHint

source§

fn clone(&self) -> CoreHint

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for CoreHint

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<CoreHint> for CoreHintBase

source§

fn from(value: CoreHint) -> Self

Converts to this type from the input type.
source§

impl From<CoreHint> for Hint

source§

fn from(value: CoreHint) -> Self

Converts to this type from the input type.
source§

impl PartialEq for CoreHint

source§

fn eq(&self, other: &CoreHint) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PythonicHint for CoreHint

source§

impl Eq for CoreHint

source§

impl StructuralPartialEq for CoreHint

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> Upcast<T> for T
where T: ?Sized,

source§

fn upcast(&self) -> &T

source§

impl<T> UpcastMut<T> for T
where T: ?Sized,

source§

fn upcast_mut(&mut self) -> &mut T