Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
7e6523fb
Commit
7e6523fb
authored
Sep 23, 2012
by
Stefan Krah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use C-style comments.
parent
2b7a71d6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
24 deletions
+24
-24
Modules/_decimal/libmpdec/mpdecimal.c
Modules/_decimal/libmpdec/mpdecimal.c
+24
-24
No files found.
Modules/_decimal/libmpdec/mpdecimal.c
View file @
7e6523fb
...
...
@@ -5063,28 +5063,28 @@ _karatsuba_rec(mpd_uint_t *c, const mpd_uint_t *a, const mpd_uint_t *b,
return
;
}
m
=
(
la
+
1
)
/
2
;
/
/ ceil(la/2)
m
=
(
la
+
1
)
/
2
;
/
* ceil(la/2) */
/* lb <= m < la */
if
(
lb
<=
m
)
{
/* lb can now be larger than la-m */
if
(
lb
>
la
-
m
)
{
lt
=
lb
+
lb
+
1
;
/
/ space needed for result array
mpd_uint_zero
(
w
,
lt
);
/
/ clear result array
_karatsuba_rec
(
w
,
b
,
a
+
m
,
w
+
lt
,
lb
,
la
-
m
);
/
/ b*ah
lt
=
lb
+
lb
+
1
;
/
* space needed for result array */
mpd_uint_zero
(
w
,
lt
);
/
* clear result array */
_karatsuba_rec
(
w
,
b
,
a
+
m
,
w
+
lt
,
lb
,
la
-
m
);
/
* b*ah */
}
else
{
lt
=
(
la
-
m
)
+
(
la
-
m
)
+
1
;
/
/ space needed for result array
mpd_uint_zero
(
w
,
lt
);
/
/ clear result array
_karatsuba_rec
(
w
,
a
+
m
,
b
,
w
+
lt
,
la
-
m
,
lb
);
/
/ ah*b
lt
=
(
la
-
m
)
+
(
la
-
m
)
+
1
;
/
* space needed for result array */
mpd_uint_zero
(
w
,
lt
);
/
* clear result array */
_karatsuba_rec
(
w
,
a
+
m
,
b
,
w
+
lt
,
la
-
m
,
lb
);
/
* ah*b */
}
_mpd_baseaddto
(
c
+
m
,
w
,
(
la
-
m
)
+
lb
);
/
/ add ah*b*B**m
_mpd_baseaddto
(
c
+
m
,
w
,
(
la
-
m
)
+
lb
);
/
* add ah*b*B**m */
lt
=
m
+
m
+
1
;
/
/ space needed for the result array
mpd_uint_zero
(
w
,
lt
);
/
/ clear result array
_karatsuba_rec
(
w
,
a
,
b
,
w
+
lt
,
m
,
lb
);
/
/ al*b
_mpd_baseaddto
(
c
,
w
,
m
+
lb
);
/
/ add al*b
lt
=
m
+
m
+
1
;
/
* space needed for the result array */
mpd_uint_zero
(
w
,
lt
);
/
* clear result array */
_karatsuba_rec
(
w
,
a
,
b
,
w
+
lt
,
m
,
lb
);
/
* al*b */
_mpd_baseaddto
(
c
,
w
,
m
+
lb
);
/
* add al*b */
return
;
}
...
...
@@ -5360,34 +5360,34 @@ _karatsuba_rec_fnt(mpd_uint_t *c, const mpd_uint_t *a, const mpd_uint_t *b,
return
1
;
}
m
=
(
la
+
1
)
/
2
;
/
/ ceil(la/2)
m
=
(
la
+
1
)
/
2
;
/
* ceil(la/2) */
/* lb <= m < la */
if
(
lb
<=
m
)
{
/* lb can now be larger than la-m */
if
(
lb
>
la
-
m
)
{
lt
=
lb
+
lb
+
1
;
/
/ space needed for result array
mpd_uint_zero
(
w
,
lt
);
/
/ clear result array
if
(
!
_karatsuba_rec_fnt
(
w
,
b
,
a
+
m
,
w
+
lt
,
lb
,
la
-
m
))
{
/
/ b*ah
lt
=
lb
+
lb
+
1
;
/
* space needed for result array */
mpd_uint_zero
(
w
,
lt
);
/
* clear result array */
if
(
!
_karatsuba_rec_fnt
(
w
,
b
,
a
+
m
,
w
+
lt
,
lb
,
la
-
m
))
{
/
* b*ah */
return
0
;
/* GCOV_UNLIKELY */
}
}
else
{
lt
=
(
la
-
m
)
+
(
la
-
m
)
+
1
;
/
/ space needed for result array
mpd_uint_zero
(
w
,
lt
);
/
/ clear result array
if
(
!
_karatsuba_rec_fnt
(
w
,
a
+
m
,
b
,
w
+
lt
,
la
-
m
,
lb
))
{
/
/ ah*b
lt
=
(
la
-
m
)
+
(
la
-
m
)
+
1
;
/
* space needed for result array */
mpd_uint_zero
(
w
,
lt
);
/
* clear result array */
if
(
!
_karatsuba_rec_fnt
(
w
,
a
+
m
,
b
,
w
+
lt
,
la
-
m
,
lb
))
{
/
* ah*b */
return
0
;
/* GCOV_UNLIKELY */
}
}
_mpd_baseaddto
(
c
+
m
,
w
,
(
la
-
m
)
+
lb
);
/
/ add ah*b*B**m
_mpd_baseaddto
(
c
+
m
,
w
,
(
la
-
m
)
+
lb
);
/
* add ah*b*B**m */
lt
=
m
+
m
+
1
;
/
/ space needed for the result array
mpd_uint_zero
(
w
,
lt
);
/
/ clear result array
if
(
!
_karatsuba_rec_fnt
(
w
,
a
,
b
,
w
+
lt
,
m
,
lb
))
{
/
/ al*b
lt
=
m
+
m
+
1
;
/
* space needed for the result array */
mpd_uint_zero
(
w
,
lt
);
/
* clear result array */
if
(
!
_karatsuba_rec_fnt
(
w
,
a
,
b
,
w
+
lt
,
m
,
lb
))
{
/
* al*b */
return
0
;
/* GCOV_UNLIKELY */
}
_mpd_baseaddto
(
c
,
w
,
m
+
lb
);
/
/ add al*b
_mpd_baseaddto
(
c
,
w
,
m
+
lb
);
/
* add al*b */
return
1
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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