Repository navigation
Conversation
The x86 multibyteDivAssign routine excludes power-of-two divisors, but the single-limb BigInt division path can pass them directly. Even BigInt!2(1) /= BigInt!2(1) raises STATUS_INTEGER_OVERFLOW with Windows LDC 1.43.0 in both unoptimized and optimized builds. Route power-of-two divisors through the existing portable divider within the x86 dispatcher, preserving the incoming remainder and retaining assembly for other divisors. Add regression coverage for every uint power of two, one- through four-limb inputs, nonzero incoming remainders, and non-power-of-two controls against ulong arithmetic. Cover compile-time evaluation and public BigInt quotient, remainder, and scalar division paths. AI-Assisted-By: Codex (GPT-6 Astra Medium)
Contributor
Author
|
CI failures are due to an outstanding Codecov issue |
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.
BigInt!2(1) /= BigInt!2(1)raisesSTATUS_INTEGER_OVERFLOW(0xc0000095) on Windows LDC x86 because the single-limb division path forwards a power-of-two divisor to an assembly routine whose contract excludes it. The failure reproduces with both-O0and-O2 -enable-inlining.Route power-of-two divisors through the existing portable divider inside the x86 dispatcher, preserving the incoming remainder and retaining assembly for other divisors.
Fixes #505.
Regression coverage
ulongarithmetic: everyuintpower of two, eight non-power-of-two controls, three incoming remainder choices, four input patterns, and lengths from one through four limbs.1 / 1, BigInt quotient/modulo, and scalar division for everyuintpower of two.Validation
ci-bignum-test/unittest-ci, combined build: 19 modules passed. An isolated recipe selected the existing mir-core 1.7.4 by path and omitted the unusedsillyconfiguration for offline resolution.git diff --checkpassed.Linux x86 execution was not validated: compilation reached linking, but the local WSL installation lacks the required system multilib files. These are local validation results; remote CI has not run for a PR.
AI-Assisted-By: Codex (GPT-6 Astra Medium)