Skip to content

Commit

Permalink
Try again
Browse files Browse the repository at this point in the history
  • Loading branch information
benbrandt committed Jan 13, 2024
1 parent 7e5de47 commit e1b7719
Show file tree
Hide file tree
Showing 13 changed files with 3,707 additions and 3,586 deletions.
5 changes: 2 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -629,10 +629,9 @@ where
let mut low = 0;
let mut high = sections.len().saturating_sub(1);
let mut last_chunk_size = None;
let mut mid = low + (high - low) / 2;

while low <= high {
mid = low + (high - low) / 2;
let mid = low + (high - low) / 2;
let (offset, str) = sections[mid];
let text_end = offset + str.len();
let chunk = self.text.get(start..text_end)?;
Expand Down Expand Up @@ -677,7 +676,7 @@ where
// the same amount of tokens.
if let Some(last_chunk_size) = last_chunk_size {
if last_chunk_size.fits.is_le() {
for (offset, str) in sections.iter().skip(mid) {
for (offset, str) in sections.iter().skip(low.min(high)) {
let text_end = offset + str.len();
let chunk = self.text.get(start..text_end)?;
let chunk_size = self.check_capacity(start, chunk);
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading

0 comments on commit e1b7719

Please sign in to comment.