Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
raviqqe committed Dec 7, 2024
1 parent fcf2051 commit df34017
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions melior/src/helpers/arith.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,91 +31,103 @@ pub trait ArithBlockExt<'c>: BuiltinBlockExt<'c> {
location: Location<'c>,
) -> Result<Value<'c, '_>, Error>;

/// Creates an `arith.extui` operation.
fn extsi(
&self,
lhs: Value<'c, '_>,
target_type: Type<'c>,
location: Location<'c>,
) -> Result<Value<'c, '_>, Error>;

/// Creates an `arith.extui` operation.
fn trunci(
&self,
lhs: Value<'c, '_>,
target_type: Type<'c>,
location: Location<'c>,
) -> Result<Value<'c, '_>, Error>;

/// Creates an `arith.shri` operation.

Check warning on line 50 in melior/src/helpers/arith.rs

View workflow job for this annotation

GitHub Actions / spell-check

Unknown word (shri)
fn shrui(
&self,
lhs: Value<'c, '_>,
rhs: Value<'c, '_>,
location: Location<'c>,
) -> Result<Value<'c, '_>, Error>;

/// Creates an `arith.shli` operation.
fn shli(
&self,
lhs: Value<'c, '_>,
rhs: Value<'c, '_>,
location: Location<'c>,
) -> Result<Value<'c, '_>, Error>;

/// Creates an `arith.addi` operation.
fn addi(
&self,
lhs: Value<'c, '_>,
rhs: Value<'c, '_>,
location: Location<'c>,
) -> Result<Value<'c, '_>, Error>;

/// Creates an `arith.subi` operation.
fn subi(
&self,
lhs: Value<'c, '_>,
rhs: Value<'c, '_>,
location: Location<'c>,
) -> Result<Value<'c, '_>, Error>;

fn divui(
/// Creates an `arith.muli` operation.
fn muli(
&self,
lhs: Value<'c, '_>,
rhs: Value<'c, '_>,
location: Location<'c>,
) -> Result<Value<'c, '_>, Error>;

fn divsi(
/// Creates an `arith.divui` operation.
fn divui(
&self,
lhs: Value<'c, '_>,
rhs: Value<'c, '_>,
location: Location<'c>,
) -> Result<Value<'c, '_>, Error>;

fn xori(
/// Creates an `arith.divsi` operation.
fn divsi(
&self,
lhs: Value<'c, '_>,
rhs: Value<'c, '_>,
location: Location<'c>,
) -> Result<Value<'c, '_>, Error>;

fn ori(
/// Creates an `arith.xori` operation.
fn xori(
&self,
lhs: Value<'c, '_>,
rhs: Value<'c, '_>,
location: Location<'c>,
) -> Result<Value<'c, '_>, Error>;

fn andi(
/// Creates an `arith.ori` operation.
fn ori(
&self,
lhs: Value<'c, '_>,
rhs: Value<'c, '_>,
location: Location<'c>,
) -> Result<Value<'c, '_>, Error>;

fn muli(
/// Creates an `arith.andi` operation.
fn andi(
&self,
lhs: Value<'c, '_>,
rhs: Value<'c, '_>,
location: Location<'c>,
) -> Result<Value<'c, '_>, Error>;

/// Creates a constant of the given integer bit width. Do not use for felt252.
/// Creates a constant of the given integer bit width.
fn const_int<T: fmt::Display>(
&self,
context: &'c Context,
Expand All @@ -124,7 +136,7 @@ pub trait ArithBlockExt<'c>: BuiltinBlockExt<'c> {
bits: u32,
) -> Result<Value<'c, '_>, Error>;

/// Creates a constant of the given integer type. Do not use for felt252.
/// Creates a constant of the given integer type.
fn const_int_from_type<T: fmt::Display>(
&self,
context: &'c Context,
Expand Down

0 comments on commit df34017

Please sign in to comment.