1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

Removed the use of g10defs.h.

This required some code cleanups and the introduction of
a few accessor ducntions in mpi.
This commit is contained in:
Werner Koch 2006-12-11 19:54:53 +00:00
parent d382fece03
commit 9f433cccca
29 changed files with 267 additions and 157 deletions

View file

@ -379,7 +379,7 @@ mpi_copy( MPI a )
/****************
* This function allocates an MPI which is optimized to hold
* a value as large as the one given in the arhgument and allocates it
* a value as large as the one given in the argument and allocates it
* with the same flags as A.
*/
MPI
@ -468,3 +468,40 @@ mpi_swap( MPI a, MPI b)
tmp = *a; *a = *b; *b = tmp;
}
int
mpi_get_nlimbs (MPI a)
{
return a->nlimbs;
}
int
mpi_is_neg (MPI a)
{
return a->sign;
}
/* Return the number of limbs to store an MPI which is specified by
the number of bytes to represent it. */
unsigned int
mpi_nlimb_hint_from_nbytes (unsigned int nbytes)
{
return (nbytes+BYTES_PER_MPI_LIMB-1) / BYTES_PER_MPI_LIMB;
}
/* Return the number of limbs to store an MPI which is specified by
the number of bytes to represent it. */
unsigned int
mpi_nlimb_hint_from_nbits (unsigned int nbits)
{
return (nbits+BITS_PER_MPI_LIMB-1) / BITS_PER_MPI_LIMB;
}
unsigned int
mpi_get_flags (MPI a)
{
return a->flags;
}