Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
nettle
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dmitry Baryshkov
nettle
Commits
38859630
Commit
38859630
authored
Mar 23, 2013
by
Martin Storsjö
Committed by
Niels Möller
Apr 4, 2013
Browse files
Options
Downloads
Patches
Plain Diff
Add fallback functions for mpn_copyd, mpn_copyi and mpn_zero.
parent
0d039117
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
ChangeLog
+4
-0
4 additions, 0 deletions
ChangeLog
gmp-glue.c
+26
-0
26 additions, 0 deletions
gmp-glue.c
gmp-glue.h
+26
-0
26 additions, 0 deletions
gmp-glue.h
with
56 additions
and
0 deletions
ChangeLog
+
4
−
0
View file @
38859630
2013-04-04 Niels Möller <nisse@lysator.liu.se>
From Martin Storsjö. Fallback functions for older GMP releases.
* gmp-glue.c (mpn_copyd, mpn_copyi, mpn_zero): New functions.
* gmp-glue.h: Declare them.
* gmp-glue.h (cnd_add_n, cnd_sub_n): Moved here, define in terms
of mpn_cnd_add_n and mpn_sub_n if available, otherwise in terms of
mpn_addmul_1 and mpn_submul_1. This seems to be an improvement for
...
...
This diff is collapsed.
Click to expand it.
gmp-glue.c
+
26
−
0
View file @
38859630
...
...
@@ -106,6 +106,32 @@ mpz_roinit_n (mpz_ptr x, const mp_limb_t *xp, mp_size_t xs)
}
#endif
/* !GMP_HAVE_mpz_limbs_read */
#if !GMP_HAVE_mpn_copyd
void
mpn_copyd
(
mp_ptr
dst
,
mp_srcptr
src
,
mp_size_t
n
)
{
mp_size_t
i
;
for
(
i
=
n
-
1
;
i
>=
0
;
i
--
)
dst
[
i
]
=
src
[
i
];
}
void
mpn_copyi
(
mp_ptr
dst
,
mp_srcptr
src
,
mp_size_t
n
)
{
mp_size_t
i
;
for
(
i
=
0
;
i
<
n
;
i
++
)
dst
[
i
]
=
src
[
i
];
}
void
mpn_zero
(
mp_ptr
ptr
,
mp_size_t
n
)
{
mp_size_t
i
;
for
(
i
=
0
;
i
<
n
;
i
++
)
ptr
[
i
]
=
0
;
}
#endif
/* !GMP_HAVE_mpn_copyd */
/* Additional convenience functions. */
int
...
...
This diff is collapsed.
Click to expand it.
gmp-glue.h
+
26
−
0
View file @
38859630
...
...
@@ -33,6 +33,12 @@
#define GMP_HAVE_mpz_limbs_read 0
#endif
#ifdef mpn_copyd
#define GMP_HAVE_mpn_copyd 1
#else
#define GMP_HAVE_mpn_copyd 0
#endif
/* Name mangling. */
#if !GMP_HAVE_mpz_limbs_read
#define mpz_limbs_read _nettle_mpz_limbs_read
...
...
@@ -42,6 +48,12 @@
#define mpz_roinit_n _nettle_mpz_roinit_n
#endif
#if !GMP_HAVE_mpn_copyd
#define mpn_copyd _nettle_mpn_copyd
#define mpn_copyi _nettle_mpn_copyi
#define mpn_zero _nettle_mpn_zero
#endif
#define mpz_limbs_cmp _nettle_mpz_limbs_cmp
#define mpz_limbs_read_n _nettle_mpz_limbs_read_n
#define mpz_limbs_copy _nettle_mpz_limbs_copy
...
...
@@ -92,6 +104,20 @@ mpz_roinit_n (mpz_ptr x, const mp_limb_t *xp, mp_size_t xs);
#endif
/* !GMP_HAVE_mpz_limbs_read */
#if !GMP_HAVE_mpn_copyd
/* Copy elements, backwards */
void
mpn_copyd
(
mp_ptr
dst
,
mp_srcptr
src
,
mp_size_t
n
);
/* Copy elements, forwards */
void
mpn_copyi
(
mp_ptr
dst
,
mp_srcptr
src
,
mp_size_t
n
);
/* Zero elements */
void
mpn_zero
(
mp_ptr
ptr
,
mp_size_t
n
);
#endif
/* !GMP_HAVE_mpn_copyd */
/* Convenience functions */
int
mpz_limbs_cmp
(
mpz_srcptr
a
,
const
mp_limb_t
*
bp
,
mp_size_t
bn
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment