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

feat: OverflowingMul trait #5172

Merged
merged 2 commits into from
Feb 29, 2024
Merged

Conversation

enitrat
Copy link
Contributor

@enitrat enitrat commented Feb 29, 2024

I haven't implemented OverflowingMul for signed integers as the implementation is a bit more complex and I'm not sure about the most efficient approach yet.


This change is Reviewable

@enitrat enitrat force-pushed the feat/overflowing-mul branch from d815851 to 8208bbb Compare February 29, 2024 10:57
@enitrat enitrat force-pushed the feat/overflowing-mul branch from 8208bbb to c90085c Compare February 29, 2024 10:58
Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed all commit messages.
Reviewable status: 0 of 5 files reviewed, 1 unresolved discussion (waiting on @enitrat)


corelib/src/integer.cairo line 2970 at r1 (raw file):

        } else {
            (wide_result.try_into().unwrap(), false)
        }

since we are worse case based:

Suggestion:

        let MASK: u16 = BoundedInt::<u8>::max().into();
        let (v_low, _, v_with_low_masked) = u8_bitwise(wide_result, MASK);
        (v_low, v_with_low_masked != MASK)

Copy link
Contributor Author

@enitrat enitrat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 5 files reviewed, 1 unresolved discussion (waiting on @orizi)


corelib/src/integer.cairo line 2970 at r1 (raw file):

Previously, orizi wrote…

since we are worse case based:

What are the returned values of ux_bitwise extern functions?

Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 5 files reviewed, 1 unresolved discussion (waiting on @enitrat)


corelib/src/integer.cairo line 2970 at r1 (raw file):

Previously, enitrat (Mathieu) wrote…

What are the returned values of ux_bitwise extern functions?

(and, xor, or)

Copy link
Contributor Author

@enitrat enitrat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 5 files reviewed, 1 unresolved discussion (waiting on @orizi)


corelib/src/integer.cairo line 2970 at r1 (raw file):

Previously, orizi wrote…

(and, xor, or)

Done. Added a boyscout line documenting the biwtise libfunc.

Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 4 of 5 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @enitrat)

a discussion (no related file):
@gilbens-starkware


Copy link
Contributor

@gilbens-starkware gilbens-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @enitrat)

@orizi orizi added this pull request to the merge queue Feb 29, 2024
Merged via the queue into starkware-libs:main with commit 64dedcb Feb 29, 2024
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants