Skip to content

Commit

Permalink
Change CodePointInversionList's size to u32 (#3585)
Browse files Browse the repository at this point in the history
  • Loading branch information
skius authored Jun 28, 2023
1 parent e560855 commit 243f2c6
Show file tree
Hide file tree
Showing 143 changed files with 514 additions and 514 deletions.
14 changes: 7 additions & 7 deletions components/collections/src/codepointinvlist/cpinvlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub struct CodePointInversionList<'data> {

// Implements an [inversion list.](https://en.wikipedia.org/wiki/Inversion_list)
inv_list: ZeroVec<'data, u32>,
size: usize,
size: u32,
}

#[cfg(feature = "serde")]
Expand Down Expand Up @@ -179,15 +179,15 @@ impl<'data> CodePointInversionList<'data> {
<u32 as AsULE>::from_unaligned(end_points[1])
- <u32 as AsULE>::from_unaligned(end_points[0])
})
.sum::<u32>() as usize;
.sum::<u32>();
Ok(Self { inv_list, size })
} else {
Err(CodePointInversionListError::InvalidSet(inv_list.to_vec()))
}
}

#[doc(hidden)] // databake internal
pub const unsafe fn from_parts_unchecked(inv_list: ZeroVec<'data, u32>, size: usize) -> Self {
pub const unsafe fn from_parts_unchecked(inv_list: ZeroVec<'data, u32>, size: u32) -> Self {
Self { inv_list, size }
}

Expand Down Expand Up @@ -295,7 +295,7 @@ impl<'data> CodePointInversionList<'data> {
pub fn all() -> Self {
Self {
inv_list: ALL_VEC,
size: (char::MAX as usize) + 1,
size: (char::MAX as u32) + 1,
}
}

Expand Down Expand Up @@ -324,7 +324,7 @@ impl<'data> CodePointInversionList<'data> {
pub fn bmp() -> Self {
Self {
inv_list: BMP_INV_LIST_VEC,
size: (BMP_MAX as usize) + 1,
size: BMP_MAX + 1,
}
}

Expand Down Expand Up @@ -461,7 +461,7 @@ impl<'data> CodePointInversionList<'data> {
if self.is_empty() {
return 0;
}
self.size
self.size as usize
}

/// Returns whether or not the [`CodePointInversionList`] is empty
Expand Down Expand Up @@ -995,7 +995,7 @@ mod tests {
b"0\0\0\0:\0\0\0A\0\0\0G\0\0\0a\0\0\0g\0\0\0"
)
},
22usize,
22u32,
)
},
icu_collections,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 243f2c6

Please sign in to comment.