Skip to content

fix: safe i32-to-usize casts in AO sampling#2

Merged
LachyFS merged 1 commit into
mainfrom
fix/ao-safe-casts
Apr 1, 2026
Merged

fix: safe i32-to-usize casts in AO sampling#2
LachyFS merged 1 commit into
mainfrom
fix/ao-safe-casts

Conversation

@LachyFS

@LachyFS LachyFS commented Apr 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add coord_as_usize() helper for bounds-checked i32→usize conversion
  • Refactor sample_block_opaque() to use it, making all casts explicitly safe

Test plan

  • cargo test (72/72 pass)
  • cargo clippy --all-targets -- -D warnings
  • cargo fmt --all -- --check

Add coord_as_usize() helper that returns Option<usize> for
bounds-checked coordinate conversion. Refactor sample_block_opaque()
to use it, making i32→usize casts explicitly safe.
@LachyFS LachyFS merged commit f2e3a66 into main Apr 1, 2026
1 check passed
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.

1 participant