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
f85fd79c
Commit
f85fd79c
authored
Apr 25, 2017
by
Damien George
Browse files
py/mpz: In mpn_sub, use existing function to remove trailing zeros.
parent
810133d9
Changes
1
Hide whitespace changes
Inline
Side-by-side
py/mpz.c
View file @
f85fd79c
...
...
@@ -49,6 +49,12 @@
Definition of normalise: ?
*/
STATIC
size_t
mpn_remove_trailing_zeros
(
mpz_dig_t
*
oidig
,
mpz_dig_t
*
idig
)
{
for
(
--
idig
;
idig
>=
oidig
&&
*
idig
==
0
;
--
idig
)
{
}
return
idig
+
1
-
oidig
;
}
/* compares i with j
returns sign(i - j)
assumes i, j are normalised
...
...
@@ -190,16 +196,7 @@ STATIC size_t mpn_sub(mpz_dig_t *idig, const mpz_dig_t *jdig, size_t jlen, const
borrow
>>=
DIG_SIZE
;
}
for
(
--
idig
;
idig
>=
oidig
&&
*
idig
==
0
;
--
idig
)
{
}
return
idig
+
1
-
oidig
;
}
STATIC
size_t
mpn_remove_trailing_zeros
(
mpz_dig_t
*
oidig
,
mpz_dig_t
*
idig
)
{
for
(
--
idig
;
idig
>=
oidig
&&
*
idig
==
0
;
--
idig
)
{
}
return
idig
+
1
-
oidig
;
return
mpn_remove_trailing_zeros
(
oidig
,
idig
);
}
#if MICROPY_OPT_MPZ_BITWISE
...
...
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