[naga] Simplify function names and comments.

Remove the phrase "zero-based" from comments and function names. Now
that there is no mix of zero-based and one-based indices, there's no
need to call out the distinction.
This commit is contained in:
Jim Blandy 2024-06-18 11:53:18 -07:00 committed by Teodor Tanasoaia
parent 9f498fd571
commit 090c906cb7
2 changed files with 7 additions and 7 deletions

View File

@ -89,7 +89,7 @@ impl<T> Handle<T> {
}
}
/// Returns the zero-based index of this handle.
/// Returns the index of this handle.
pub const fn index(self) -> usize {
self.index.get() as usize
}
@ -221,13 +221,13 @@ impl<T> Range<T> {
}
}
/// Return the zero-based index range covered by `self`.
pub fn zero_based_index_range(&self) -> ops::Range<u32> {
/// Return the index range covered by `self`.
pub fn index_range(&self) -> ops::Range<u32> {
self.inner.clone()
}
/// Construct a `Range` that covers the zero-based indices in `inner`.
pub fn from_zero_based_index_range(inner: ops::Range<u32>, arena: &Arena<T>) -> Self {
/// Construct a `Range` that covers the indices in `inner`.
pub fn from_index_range(inner: ops::Range<u32>, arena: &Arena<T>) -> Self {
// Since `inner` is a `Range<u32>`, we only need to check that
// the start and end are well-ordered, and that the end fits
// within `arena`.

View File

@ -137,7 +137,7 @@ impl<T: 'static> HandleMap<T> {
///
/// Use `compacted_arena` to bounds-check the result.
pub fn adjust_range(&self, range: &mut Range<T>, compacted_arena: &Arena<T>) {
let mut index_range = range.zero_based_index_range();
let mut index_range = range.index_range();
let compacted;
if let Some(first) = index_range.find_map(|i| self.new_index[i as usize]) {
// The first call to `find_map` mutated `index_range` to hold the
@ -155,6 +155,6 @@ impl<T: 'static> HandleMap<T> {
} else {
compacted = 0..0;
};
*range = Range::from_zero_based_index_range(compacted, compacted_arena);
*range = Range::from_index_range(compacted, compacted_arena);
}
}