fix: enable runtime usage of inverse function by using compile-time unit extraction#726
Merged
mpusz merged 3 commits intompusz:masterfrom Dec 21, 2025
Merged
Conversation
mpusz
reviewed
Sep 29, 2025
b6f46a7 to
45754e7
Compare
Owner
|
Is this fix still needed? |
…nit extraction Replace runtime unit access (q.unit) with compile-time type extraction (get_unit(R)) in the inverse function implementation. This prevents the function from becoming an immediate function when consteval unit operators are used, allowing inverse to work with runtime variables. Key changes: - math.h: Use get_unit(R) instead of q.unit in both code paths - test: Add comprehensive runtime inverse tests This surgical fix preserves maximum compile-time optimization while enabling DSP applications that need runtime inverse calculations. Fixes compilation error with Clang: "call to immediate function 'inverse' is not a constant expression" 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
45754e7 to
507b2db
Compare
Contributor
Author
Yes this is still needed. @mpusz do you think this looks good to merge? (I didn't mean to close the PR just now — I hit the wrong button) |
mpusz
added a commit
that referenced
this pull request
Dec 20, 2025
mpusz
approved these changes
Dec 21, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace runtime unit access (q.unit) with compile-time type extraction (get_unit(R)) in the inverse function implementation. This prevents the function from becoming an immediate function when consteval unit operators are used, allowing inverse to work with runtime variables.
Key changes:
This surgical fix preserves maximum compile-time optimization while enabling DSP applications that need runtime inverse calculations.
Fixes compilation error with Clang:
"call to immediate function 'inverse' is not a constant expression"
🤖 Generated with Claude Code