Display for a felt-sized push immediate byte-swaps the value
- Ngôn ngữ chính
- Rust
- Star
- 772
- Fork
- 352
- Merge trung bình
- 1 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 93
Mô tả
`impl fmt::Display for IntValue` (`crates/assembly-syntax/src/parser/value.rs`) renders the `Felt` variant as `write!(f, "{:#08x}", value.as_canonical_u64().to_be())`. The `to_be()` reverses the byte order before formatting, so the printed hex is a different number than the value it came from.
`IntValue::Felt(Felt::new_unchecked(1 << 32)).to_string()` gives `0x1000000` (16777216) rather than `0x100000000` (2^32), and that string parses back to the wrong value. The `U32` arm just above formats without a swap, and `PrettyPrint` renders the canonical value, so the `Felt` arm is the odd one out. `IntValue` and `PushValue` are `pub use`-exported from `pub mod parser`, so any external `to_string()`/`{}` on a felt-range immediate is affected.
The fix is to drop the `to_be()`. I have a patch ready with a regression test (`cargo test -p miden-assembly-syntax` 271 passed, `fmt --check` and `clippy` clean) — could this be assigned to me so I can open the PR per the contribution guidelines?
Hướng dẫn đóng góp
Đánh giá
Issue này chưa được đánh giá.