-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
GH-101291: Rearrange the size bits in PyLongObject #102464
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
Changes from 1 commit
0ec07e4
292b9d0
5c54894
029aaa4
b56e6da
91269fc
c48e825
449c0e2
c5ba601
4b3a3e8
9ef9d2c
9c408c1
548d656
3e3fefd
391fb51
df8c7d3
bc14fa6
54c6f1b
ce6bfb2
4c1956b
301158b
1aa1891
bf2a9af
169f521
90f9072
f143443
a0d661e
145a2e4
638a98f
7f5acc0
b06bb6f
a19b0a7
87f49b2
f764aa8
9843ac0
d6cb917
469d26f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
…tCount().
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -3488,7 +3488,7 @@ x_mul(PyLongObject *a, PyLongObject *b) | |||||
| if (z == NULL) | ||||||
| return NULL; | ||||||
|
|
||||||
| memset(z->long_value.ob_digit, 0, Py_SIZE(z) * sizeof(digit)); | ||||||
| memset(z->long_value.ob_digit, 0, _PyLong_UnsignedDigitCount(z) * sizeof(digit)); | ||||||
|
||||||
| memset(z->long_value.ob_digit, 0, _PyLong_UnsignedDigitCount(z) * sizeof(digit)); | |
| memset(z->long_value.ob_digit, 0, _PyLong_DigitCount(z) * sizeof(digit)); |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should just check the sign, right?
| assert(_PyLong_UnsignedDigitCount(ah) > 0); /* the split isn't degenerate */ | |
| assert(_PyLong_IsPositive(ah)); /* the split isn't degenerate */ |
Same below several occurrences.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should really check the sign:
| assert(_PyLong_UnsignedDigitCount(t3) >= 0); | |
| assert(!_PyLong_IsNegative(t3)); |
Same several times above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not excited about this name; I keep having to look up how it differs from
_PyLong_DigitCount, and it's not really related to_PyLong_SignedDigitCount. :-( Maybe_PyLong_NonNegativeDigitCount? Or perhaps better_PyLong_DigitCountOfNonNegative?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I needed this for the extra check during implementation.
_PyLong_UnsignedDigitCountis now the same as_PyLong_DigitCount, and should remain so.I'll remove it.