Skip to content

#142: Make integer overflow semantics explicit - #144

Open
zaguzovmaksim0-hue wants to merge 1 commit into
objectionary:masterfrom
zaguzovmaksim0-hue:142
Open

zaguzovmaksim0-hue wants to merge 1 commit into
objectionary:masterfrom
zaguzovmaksim0-hue:142

Conversation

@zaguzovmaksim0-hue

Copy link
Copy Markdown

Closes #142.

The four integer atoms whose plain i16 arithmetic changed behavior between debug and release builds now use explicit two's-complement wrapping operations: wrapping_add, wrapping_sub, wrapping_mul, and wrapping_neg.

This preserves the release-mode arithmetic result while removing the debug-only overflow panic. It also fits the current Atom = fn(...) -> Option<Data> contract: None means that an input is not yet dataized, so using checked_* and returning None for arithmetic overflow would incorrectly make overflow look like a missing operand and could leave the emulator stuck.

Regression tests cover all four boundaries, including i16::MAX + 1 and negation of i16::MIN.

Validation on Android/Termux:

  • cargo fmt -- --check — passed;
  • cargo test --all-targets — passed;
  • cargo clippy --all-targets --all-features -- -D warnings — passed;
  • git diff --check — clean.

@codecov

codecov Bot commented Sep 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.11%. Comparing base (6025413) to head (2e9743d).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #144      +/-   ##
==========================================
+ Coverage   94.09%   94.11%   +0.02%     
==========================================
  Files          14       14              
  Lines         711      714       +3     
==========================================
+ Hits          669      672       +3     
  Misses         42       42              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Arithmetic overflow makes phie results depend on the Cargo build profile

1 participant