Skip to content

refactor: use u32_from_slice#1128

Merged
marxin merged 1 commit into
wild-linker:mainfrom
marxin:use-u32_from_slice
Sep 29, 2025
Merged

refactor: use u32_from_slice#1128
marxin merged 1 commit into
wild-linker:mainfrom
marxin:use-u32_from_slice

Conversation

@marxin
Copy link
Copy Markdown
Collaborator

@marxin marxin commented Sep 29, 2025

No description provided.

@marxin marxin requested a review from Copilot September 29, 2025 17:24
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors code to use a centralized u32_from_slice utility function instead of manual byte array conversions. The change standardizes the way 32-bit values are extracted from byte slices across multiple architecture-specific modules.

  • Replaces manual u32::from_le_bytes(*bytes.first_chunk::<4>().expect(...)) calls with u32_from_slice(bytes)
  • Adds imports for the u32_from_slice utility function in affected modules
  • Simplifies byte-to-u32 conversion logic in instruction decoding and PLT entry parsing

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
linker-utils/src/riscv64.rs Refactored RISC-V instruction value extraction to use u32_from_slice
linker-utils/src/aarch64.rs Updated AArch64 instruction parsing and relaxation code to use u32_from_slice
linker-diff/src/riscv64.rs Simplified PLT entry decoding by replacing manual byte array construction
linker-diff/src/asm_diff.rs Updated relocation value reading to use u32_from_slice for 4-byte values

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@marxin marxin merged commit a8b64b2 into wild-linker:main Sep 29, 2025
19 checks passed
@marxin marxin deleted the use-u32_from_slice branch September 29, 2025 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants