Skip to content

Refactor rotmg to remove goto/labels#22

Merged
sigilante merged 1 commit into
masterfrom
fix/rotmg-no-goto
May 30, 2026
Merged

Refactor rotmg to remove goto/labels#22
sigilante merged 1 commit into
masterfrom
fix/rotmg-no-goto

Conversation

@sigilante
Copy link
Copy Markdown
Collaborator

rotmg used goto store to jump out of the two singular cases (u <= 0 and q2 < 0) to the final store block, skipping the rescaling loops.

Replaced each with a plain if/else: the non-singular work moves into the else, and the rescaling loops that follow are already no-ops once a singular case has zeroed d1/d2 — so no jump is needed. Drops both gotos and the store: label from srotmg/drotmg/hrotmg.

Behavior unchanged. Added test_srotmg_singular (q2 < 0 → all zeros, flag = -1) to cover the refactored path the goto previously guarded. 181/181.

🤖 Generated with Claude Code

The rotmg routines used `goto store` to jump out of the two singular
cases (u <= 0 and q2 < 0) to the final store block, skipping the
rescaling loops. Replace each with a plain if/else: the non-singular work
moves into the else branch, and the rescaling loops that follow are
already no-ops when a singular case has zeroed d1 and d2, so no jump is
needed. Drops both gotos and the `store:` label from srotmg/drotmg/hrotmg.

Behavior is unchanged. Added test_srotmg_singular (q2 < 0 -> all zeros,
flag = -1) to cover the refactored path that the goto previously guarded.
181/181 tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sigilante sigilante merged commit d8d8a96 into master May 30, 2026
1 check passed
@sigilante sigilante deleted the fix/rotmg-no-goto branch May 30, 2026 17:46
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