Skip to content

Fix #11047: Sufficiently big BigUint multiplications fail during CTFE#11048

Open
just-harry wants to merge 1 commit into
dlang:masterfrom
just-harry:fix-big-biguint-multiplication-failure-in-ctfe
Open

Fix #11047: Sufficiently big BigUint multiplications fail during CTFE#11048
just-harry wants to merge 1 commit into
dlang:masterfrom
just-harry:fix-big-biguint-multiplication-failure-in-ctfe

Conversation

@just-harry

Copy link
Copy Markdown
Contributor

Rationale

Feature request or issue tracking

Closes #11047.

Pre-review checklist

  • I have performed a self-review of my code.
  • If my PR fixes a bug or introduces a new feature, I have added thorough tests.
  • If my changes are non-trivial and do not concern a reported issue, I have added a changelog entry.

When both operands of a std.internal.math.biguintcore.BigUint multiplication exceed a certain threshold (the threshold appears to be 1 << 32) during CTFE, the multiplication will fail as std.internal.math.biguintcore.mulInternal attempts to use core.cpuid.dataCaches, via std.internal.math.biguintcore.getCacheLimit, to optimise algorithm selection.

The proposed fix is simple: use an arbitrary value for getCacheLimit, during CTFE, in lieu of core.cpuid.dataCaches.

getCacheLimit is used in one place, and solely to optimise algorithm selection; no functional change is introduced by this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sufficiently big BigUint multiplications fail during CTFE

2 participants