[PR #7369] [MERGED] port map: cellIndex's locate lives in storage.rs #7558

Closed
opened 2026-11-03 07:19:47 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7369
Author: @MSedgeMC
Created: 11/2/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: chore/mapgap-rest-022


📝 Commits (2)

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 tools/port_map/rest-022.tsv (+1 -1)

📄 Description

tools/port_map/rest-022.tsv row 141 cited crates/horizon-core/src/paletted.rs::locate, and paletted.rs does not define it — gaps --kind map reports no fn ...paletted.rs::locate. It is imported from storage.rs.

row was now
141 SimpleBitStorage.cellIndex port crates/horizon-core/src/paletted.rs::locate port crates/horizon-core/src/storage.rs::locate
  • locate is crates/horizon-core/src/storage.rs:27 (pub(crate) fn locate(bits: u8, i: usize) -> (usize, u32)), the word and bit shift of entry i; paletted.rs imports it at line 11 (use crate::storage::{locate, mask};) and every entry read or write goes through it — read (line 120), write (124) and PalettedContainer::raw (264). The note now says "the word and bit shift of an entry", which is what cellIndex computes and what the fn returns.

Map-check:

$ PORT_LEDGER_OUT=/tmp/led-mapgap python3 tools/port_ledger.py map-check tools/port_map/rest-022.tsv
149 rows, no problems.

Proven: storage.rs defines locate and paletted.rs imports rather than defines it, so the old cell could not resolve; the three call sites are the entry reads and writes; and locate_matches_division_for_every_width (paletted.rs:753) pins locate to the vanilla i / (64 / bits) index for every width.

Not proven: nothing beyond the citation — the verdict stays port, and the row's subject (the word index) is unchanged. storage.rs keeps the multiply-shift and table versions of the division for x86 only; that is a speed choice the test covers, not a parity claim about SimpleBitStorage.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/7369 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `chore/mapgap-rest-022` --- ### 📝 Commits (2) - [`f3c2ed1`](https://github.com/horizon-rust/horizon/commit/f3c2ed13cea81f24d8362a6d2122eec50d1e9230) port map: cellIndex's locate lives in storage.rs - [`a129fa4`](https://github.com/horizon-rust/horizon/commit/a129fa4b6bc201b923c8d6c4f840da70e3aefccc) Merge main into #7369 ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `tools/port_map/rest-022.tsv` (+1 -1) </details> ### 📄 Description `tools/port_map/rest-022.tsv` row 141 cited `crates/horizon-core/src/paletted.rs::locate`, and `paletted.rs` does not define it — `gaps --kind map` reports `no fn ...paletted.rs::locate`. It is imported from `storage.rs`. | row | was | now | | --- | --- | --- | | 141 `SimpleBitStorage.cellIndex` | `port crates/horizon-core/src/paletted.rs::locate` | `port crates/horizon-core/src/storage.rs::locate` | - `locate` is `crates/horizon-core/src/storage.rs:27` (`pub(crate) fn locate(bits: u8, i: usize) -> (usize, u32)`), the word and bit shift of entry `i`; `paletted.rs` imports it at line 11 (`use crate::storage::{locate, mask};`) and every entry read or write goes through it — `read` (line 120), `write` (124) and `PalettedContainer::raw` (264). The note now says "the word and bit shift of an entry", which is what `cellIndex` computes and what the fn returns. Map-check: ``` $ PORT_LEDGER_OUT=/tmp/led-mapgap python3 tools/port_ledger.py map-check tools/port_map/rest-022.tsv 149 rows, no problems. ``` **Proven:** `storage.rs` defines `locate` and `paletted.rs` imports rather than defines it, so the old cell could not resolve; the three call sites are the entry reads and writes; and `locate_matches_division_for_every_width` (paletted.rs:753) pins `locate` to the vanilla `i / (64 / bits)` index for every width. **Not proven:** nothing beyond the citation — the verdict stays `port`, and the row's subject (the word index) is unchanged. `storage.rs` keeps the multiply-shift and table versions of the division for x86 only; that is a speed choice the test covers, not a parity claim about `SimpleBitStorage`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 07:19:47 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#7558
No description provided.