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

Fixes to bigint 32bit #4922

Merged
merged 2 commits into from Sep 9, 2017
Merged

Conversation

akzhan
Copy link
Contributor

@akzhan akzhan commented Sep 3, 2017

Just another selection of 32bit fixes from #4675 with additions.

@bew
Copy link
Contributor

bew commented Sep 3, 2017

Could you explain briefly what were the issues before this PR?

@akzhan
Copy link
Contributor Author

akzhan commented Sep 3, 2017

@bew GMP arithmetics highly depends on LibGMP::Long and LibGMP::ULong types to provide fast paths with integers of supported types.

LibGMP built with 32bit Long/ULong on 32bit machines, otherwise 64bit (for now).

So we must take in care it's sizeof to provide correct behavior.

See also 853edff and #4653 (it's a long story)

@asterite
Copy link
Member

asterite commented Sep 5, 2017

@akzhan Is there a spec that was failing in 32 bits? I ask because these changes, without accompanying specs, seem like they aren't doing anything.

@akzhan
Copy link
Contributor Author

akzhan commented Sep 6, 2017

@asterite Just tested BigInt.+ on current master (#4931):

Failures:
  1) BigInt adds
     Failure/Error: (5.to_big_i + Int64::MAX).should be > Int64::MAX.to_big_i
       Expected 4294967300_big_i to be > 9223372036854775807
     # spec/std/big/big_int_spec.cr:84
Finished in 11.78 seconds
5281 examples, 1 failures, 0 errors, 4 pending
Failed examples:
crystal spec spec/std/big/big_int_spec.cr:79 # BigInt adds

Will add this spec to this branch.

@RX14
Copy link
Contributor

RX14 commented Sep 6, 2017

It seems like you're changing + - * / so there should be specs for all of those that beak on 32bit.

@asterite
Copy link
Member

asterite commented Sep 6, 2017

@akzhan Awesome! Thank you :-)

@sdogruyol
Copy link
Member

LGTM 👍

@RX14
Copy link
Contributor

RX14 commented Sep 8, 2017

Please remove the changelog until we decide #4936.

Copy link
Contributor

@RX14 RX14 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll merge it after you remove the changelog bit.

@akzhan
Copy link
Contributor Author

akzhan commented Sep 8, 2017

Done ( and squashed into two logical parts).

@RX14 RX14 added this to the Next milestone Sep 8, 2017
@RX14 RX14 merged commit 46197bd into crystal-lang:master Sep 9, 2017
@akzhan akzhan deleted the fixes-to-bigint-32bit branch September 9, 2017 23:14
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.

None yet

6 participants