Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
2065373f
Commit
2065373f
authored
Oct 01, 2015
by
Damien George
Browse files
py/mpz: Fix bignum anding of large negative with smaller positive int.
parent
a81539db
Changes
2
Hide whitespace changes
Inline
Side-by-side
py/mpz.c
View file @
2065373f
...
...
@@ -239,12 +239,8 @@ STATIC mp_uint_t mpn_and_neg(mpz_dig_t *idig, const mpz_dig_t *jdig, mp_uint_t j
carry
>>=
DIG_SIZE
;
}
if
(
carry
!=
0
)
{
*
idig
=
carry
;
}
else
{
// remove trailing zeros
for
(
--
idig
;
idig
>=
oidig
&&
*
idig
==
0
;
--
idig
)
{
}
// remove trailing zeros
for
(
--
idig
;
idig
>=
oidig
&&
*
idig
==
0
;
--
idig
)
{
}
return
idig
+
1
-
oidig
;
...
...
tests/basics/int_big_and.py
View file @
2065373f
...
...
@@ -24,3 +24,5 @@ print(-2345678901234567890123456789 & a)
print
((
-
a
)
&
a
)
print
((
-
a
)
&
0xffffffff
)
print
((
-
a
)
&
0xffffffffffffffffffffffffffffffff
)
print
((
-
a
)
&
2
)
print
((
-
(
1
<<
70
))
&
2
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment