mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 06:44:14 +00:00
[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:
parent
9f498fd571
commit
090c906cb7
@ -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`.
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user