From 090c906cb7cb1313227c0f03cd1765eeb8962321 Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Tue, 18 Jun 2024 11:53:18 -0700 Subject: [PATCH] [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. --- naga/src/arena.rs | 10 +++++----- naga/src/compact/handle_set_map.rs | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/naga/src/arena.rs b/naga/src/arena.rs index 1bd6007c1a..eb6b618c8f 100644 --- a/naga/src/arena.rs +++ b/naga/src/arena.rs @@ -89,7 +89,7 @@ impl Handle { } } - /// 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 Range { } } - /// Return the zero-based index range covered by `self`. - pub fn zero_based_index_range(&self) -> ops::Range { + /// Return the index range covered by `self`. + pub fn index_range(&self) -> ops::Range { self.inner.clone() } - /// Construct a `Range` that covers the zero-based indices in `inner`. - pub fn from_zero_based_index_range(inner: ops::Range, arena: &Arena) -> Self { + /// Construct a `Range` that covers the indices in `inner`. + pub fn from_index_range(inner: ops::Range, arena: &Arena) -> Self { // Since `inner` is a `Range`, we only need to check that // the start and end are well-ordered, and that the end fits // within `arena`. diff --git a/naga/src/compact/handle_set_map.rs b/naga/src/compact/handle_set_map.rs index b0d6c2e6af..57a2749f87 100644 --- a/naga/src/compact/handle_set_map.rs +++ b/naga/src/compact/handle_set_map.rs @@ -137,7 +137,7 @@ impl HandleMap { /// /// Use `compacted_arena` to bounds-check the result. pub fn adjust_range(&self, range: &mut Range, compacted_arena: &Arena) { - 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 HandleMap { } else { compacted = 0..0; }; - *range = Range::from_zero_based_index_range(compacted, compacted_arena); + *range = Range::from_index_range(compacted, compacted_arena); } }