Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve conversions from BigInt to Int::Primitive #13562

Merged
merged 3 commits into from Jun 24, 2023

Conversation

HertzDevil
Copy link
Contributor

@HertzDevil HertzDevil commented Jun 15, 2023

Resolves #11978. Resolves #12771. Fixes #13561.

BigInt now accesses its limbs directly for target types larger than LibC::Long, so there are no longer calls to BigInt#to_s or #% in these conversions. (This is especially important on Windows where Long is only 32 bits.) The new conversion to large negative signed integers requires Int::Primitive#neg_signed from #13439; this method, like #abs_unsigned, is currently not exposed.

src/big/big_int.cr Outdated Show resolved Hide resolved
src/big/big_int.cr Outdated Show resolved Hide resolved
@straight-shoota
Copy link
Member

@HertzDevil The failing Windows spec needs attention.

@straight-shoota straight-shoota added this to the 1.9.0 milestone Jun 23, 2023
@straight-shoota straight-shoota merged commit d57747d into crystal-lang:master Jun 24, 2023
50 checks passed
@HertzDevil HertzDevil deleted the feature/big-int-to_i branch June 26, 2023 10:53
Blacksmoke16 pushed a commit to Blacksmoke16/crystal that referenced this pull request Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants