diff options
author | Werner Koch <[email protected]> | 1998-03-19 15:27:29 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 1998-03-19 15:27:29 +0000 |
commit | 6b91e7762c65097a103b2b17db304a4d85b3573d (patch) | |
tree | 4303dbf887db8130c58e1025cac3c8fe291c6ceb /mpi/mpi-bit.c | |
parent | NEw test keyrings (diff) | |
download | gnupg-6b91e7762c65097a103b2b17db304a4d85b3573d.tar.gz gnupg-6b91e7762c65097a103b2b17db304a4d85b3573d.zip |
some cleanups
Diffstat (limited to '')
-rw-r--r-- | mpi/mpi-bit.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/mpi/mpi-bit.c b/mpi/mpi-bit.c index eff7be259..cae29d225 100644 --- a/mpi/mpi-bit.c +++ b/mpi/mpi-bit.c @@ -135,6 +135,25 @@ mpi_set_highbit( MPI a, unsigned n ) } /**************** + * clear bit N of A and all bits above + */ +void +mpi_clear_highbit( MPI a, unsigned n ) +{ + unsigned limbno, bitno; + + limbno = n / BITS_PER_MPI_LIMB; + bitno = n % BITS_PER_MPI_LIMB; + + if( limbno >= a->nlimbs ) + return; /* not allocated, so need to clear bits :-) */ + + for( ; bitno < BITS_PER_MPI_LIMB; bitno++ ) + a->d[limbno] &= ~(A_LIMB_1 << bitno); + a->nlimbs = limbno+1; +} + +/**************** * Clear bit N of A. */ void |