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
Bitset doctest failures on OS X #17526
Comments
Author: Jeroen Demeyer |
Branch: u/jdemeyer/ticket/17526 |
New commits:
|
Commit: |
comment:4
There is also a difference in |
comment:5
Let me try to put some semantic on the existing code (i.e., without your patch). We shift by The variable The variable If If in our example However, if Hence, I believe the following solution would be easier: if shifted_limbs <= r.limbs: # here I changed "<" to "<="
if nbits:
mpn_rshift(r.bits, a.bits + nlimbs, shifted_limbs, nbits)
else:
mpn_copyi(r.bits, a.bits + nlimbs, shifted_limbs)
# Clear top limbs (note that r.limbs - shifted_limbs >= 1)
mpn_zero(r.bits + (r.limbs - nlimbs), r.limbs - shifted_limbs)
else:
# Number of limbs to shift is r.limbs
if nbits:
mpn_rshift(r.bits, a.bits + nlimbs, r.limbs, nbits)
# Add the additional bits from top limb of a
r.bits[r.limbs-1] |= a.bits[r.limbs+nlimbs] << (GMP_LIMB_BITS - nbits)
else:
mpn_copyi(r.bits, a.bits + nlimbs, r.limbs)
# Clear bits outside bitset in top limb
bitset_fix(r) |
comment:6
You really need 3 cases, otherwise the comment |
comment:7
Replying to @jdemeyer:
... and ">=1" is needed, since
Also correct. OK, my questions are answered. I can not test if the branch fixes the problem on OSX. But the code looks good. If someone (John?) can confirm that it works on OSX, please feel free to switch to positive review. |
Reviewer: Simon King |
Changed reviewer from Simon King to Simon King, John Palmieri |
Changed branch from u/jdemeyer/ticket/17526 to |
John Palmieri reports this in two OS X systems:
I see a difference in
rshift set unset ok False
CC: @jhpalmieri @simon-king-jena
Component: misc
Author: Jeroen Demeyer
Branch/Commit:
0d1e149
Reviewer: Simon King, John Palmieri
Issue created by migration from https://trac.sagemath.org/ticket/17526
The text was updated successfully, but these errors were encountered: