Skip to content

Conversation

giladchase
Copy link
Contributor

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Contributor Author

giladchase commented Sep 16, 2025

@giladchase giladchase marked this pull request as ready for review September 16, 2025 13:18
@giladchase giladchase force-pushed the gilad/09-16-feat_byte_array_add_at_and_index_to_bytespan_ branch from f840c46 to bcf3c7d Compare September 18, 2025 07:11
@giladchase giladchase force-pushed the gilad/09-14-feat_byte_array_add_slice_ branch from d2487b7 to 235db8b Compare September 18, 2025 07:11
Copy link
Collaborator

@TomerStarkware TomerStarkware left a comment

Choose a reason for hiding this comment

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

:lgtm:

@TomerStarkware reviewed 2 of 2 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @orizi)

@giladchase giladchase force-pushed the gilad/09-14-feat_byte_array_add_slice_ branch from 235db8b to eeaa0bf Compare September 18, 2025 08:17
@giladchase giladchase force-pushed the gilad/09-16-feat_byte_array_add_at_and_index_to_bytespan_ branch from bcf3c7d to 04b763d Compare September 18, 2025 08:17
@giladchase giladchase force-pushed the gilad/09-16-feat_byte_array_add_at_and_index_to_bytespan_ branch from 04b763d to c03411e Compare September 28, 2025 06:43
@giladchase giladchase force-pushed the gilad/09-14-feat_byte_array_add_slice_ branch 2 times, most recently from 45abe52 to afd7694 Compare September 28, 2025 06:44
@giladchase giladchase force-pushed the gilad/09-16-feat_byte_array_add_at_and_index_to_bytespan_ branch 2 times, most recently from 8885cbb to a4243a8 Compare September 28, 2025 08:26
@giladchase giladchase force-pushed the gilad/09-14-feat_byte_array_add_slice_ branch 2 times, most recently from 9ab073e to b38e4cc Compare September 28, 2025 12:30
@giladchase giladchase force-pushed the gilad/09-16-feat_byte_array_add_at_and_index_to_bytespan_ branch from a4243a8 to 6769953 Compare September 28, 2025 12:30
@giladchase giladchase force-pushed the gilad/09-14-feat_byte_array_add_slice_ branch from b38e4cc to 20ea89a Compare September 28, 2025 13:00
@giladchase giladchase force-pushed the gilad/09-16-feat_byte_array_add_at_and_index_to_bytespan_ branch from 6769953 to 19ce8b6 Compare September 28, 2025 13:00
@giladchase giladchase force-pushed the gilad/09-14-feat_byte_array_add_slice_ branch from 20ea89a to bc5dfbf Compare September 29, 2025 06:44
@giladchase giladchase force-pushed the gilad/09-16-feat_byte_array_add_at_and_index_to_bytespan_ branch from 19ce8b6 to 4bf4932 Compare September 29, 2025 06:44
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.

@orizi reviewed all commit messages.
Reviewable status: 0 of 2 files reviewed, 2 unresolved discussions (waiting on @TomerStarkware)


corelib/src/byte_array.cairo line 703 at r4 (raw file):

    fn at(self: @ByteSpan, index: usize) -> Option<u8> {
        let actual_index = index.checked_add(upcast(self.first_char_start_offset))?;
        let (word_index, index_in_word) = DivRem::div_rem(actual_index, BYTES_IN_BYTES31_NONZERO);

use bounded_int::div_rem and get index_in_word in [0,30] range.
you can use bounded_int::constrain later to decide if it is accessing the lower or upper word.

Code quote:

let (word_index, index_in_word) = DivRem::div_rem(actual_index, BYTES_IN_BYTES31_NONZERO);

corelib/src/byte_array.cairo line 713 at r4 (raw file):

                if word_index == self.data.len() && index_in_word < upcast(self.remainder_len) {
                    // index_in_word is from MSB, we need index from LSB.
                    let index_in_remainder = upcast(self.remainder_len) - 1 - index_in_word;

bounded_int::sub as well.

Code quote:

 let index_in_remainder = upcast(self.remainder_len) - 1 - index_in_word;

@giladchase giladchase force-pushed the gilad/09-14-feat_byte_array_add_slice_ branch from bc5dfbf to 50fdc8e Compare September 29, 2025 07:26
@giladchase giladchase force-pushed the gilad/09-16-feat_byte_array_add_at_and_index_to_bytespan_ branch 2 times, most recently from acb4ec9 to a82ef26 Compare September 29, 2025 10:15
@giladchase giladchase force-pushed the gilad/09-14-feat_byte_array_add_slice_ branch from 50fdc8e to 079403d Compare September 29, 2025 10:15
@giladchase giladchase force-pushed the gilad/09-16-feat_byte_array_add_at_and_index_to_bytespan_ branch from a82ef26 to 4e56cca Compare September 29, 2025 10:22
@giladchase giladchase force-pushed the gilad/09-14-feat_byte_array_add_slice_ branch from 079403d to 04b050b Compare September 29, 2025 10:22
@giladchase giladchase force-pushed the gilad/09-16-feat_byte_array_add_at_and_index_to_bytespan_ branch from 4e56cca to 3a99931 Compare September 29, 2025 10:25
@giladchase giladchase force-pushed the gilad/09-14-feat_byte_array_add_slice_ branch from 04b050b to 7331124 Compare September 29, 2025 10:25
@giladchase giladchase force-pushed the gilad/09-16-feat_byte_array_add_at_and_index_to_bytespan_ branch from 3a99931 to d0a7c5c Compare September 29, 2025 10:35
@giladchase giladchase force-pushed the gilad/09-14-feat_byte_array_add_slice_ branch from 7331124 to cfb20a9 Compare September 29, 2025 10:35
@giladchase giladchase force-pushed the gilad/09-16-feat_byte_array_add_at_and_index_to_bytespan_ branch from d0a7c5c to a98d3f8 Compare September 29, 2025 12:29
@giladchase giladchase force-pushed the gilad/09-14-feat_byte_array_add_slice_ branch from cfb20a9 to 471439b Compare September 29, 2025 12:29
@giladchase giladchase force-pushed the gilad/09-16-feat_byte_array_add_at_and_index_to_bytespan_ branch from a98d3f8 to 62bd737 Compare September 29, 2025 13:45
@giladchase giladchase force-pushed the gilad/09-14-feat_byte_array_add_slice_ branch from 471439b to 5b966b7 Compare September 29, 2025 13:45
@giladchase giladchase force-pushed the gilad/09-16-feat_byte_array_add_at_and_index_to_bytespan_ branch from 62bd737 to 696e439 Compare September 29, 2025 14:02
@giladchase giladchase force-pushed the gilad/09-14-feat_byte_array_add_slice_ branch from 5b966b7 to f03f22e Compare September 29, 2025 14:02
@giladchase giladchase force-pushed the gilad/09-16-feat_byte_array_add_at_and_index_to_bytespan_ branch from 696e439 to bcf2452 Compare September 29, 2025 14:11
@giladchase giladchase force-pushed the gilad/09-14-feat_byte_array_add_slice_ branch from f03f22e to 4ffc000 Compare September 29, 2025 14:11
@giladchase giladchase force-pushed the gilad/09-16-feat_byte_array_add_at_and_index_to_bytespan_ branch from bcf2452 to 627140e Compare September 30, 2025 09:23
@giladchase giladchase force-pushed the gilad/09-14-feat_byte_array_add_slice_ branch from 4ffc000 to 5faa3d7 Compare September 30, 2025 09:23
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.

4 participants