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

Optimize integer comparisons between fixnum and bignum #2362

Merged
merged 1 commit into from
Dec 2, 2024

Conversation

seven1m
Copy link
Member

@seven1m seven1m commented Dec 1, 2024

Bignums should never be in the NAT_MIN_FIXNUM..NAT_MAX_FIXNUM range, so we can optimize some comparisons between the different backing types.

Fixes #2344.

I'm open to adding an assertion somewhere, but I couldn't think of a nice way of doing it. We could replace all the m_bignum = assignments with a setter like set_bignum() and add an assertion there. But when I grep for m_bignum = they all are in the constructors, and I figure we can easily eyeball that those are all doing the right thing. Again, open to suggestions!

Bignums should never be in the NAT_MIN_FIXNUM..NAT_MAX_FIXNUM range, so
we can optimize some comparisons between the different backing types.
@seven1m seven1m merged commit 1150a89 into master Dec 2, 2024
16 checks passed
@seven1m seven1m deleted the bigint-fixnum branch December 2, 2024 13:17
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.

Make fixnum/bigint disjoint/canonicalized
1 participant