diff options
author | Werner Koch <wk@gnupg.org> | 1998-03-19 15:27:26 +0000 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 1998-03-19 15:27:26 +0000 |
commit | fa3731d01d66ad6fcd9faf1383611e55e11a3f5a (patch) | |
tree | d46eeb9ee4859e591922182ee325da7e4c95e5e7 /mpi/mpi-bit.c | |
parent | 198d5240d567568480862afae628a4639617815f (diff) | |
download | libgcrypt-fa3731d01d66ad6fcd9faf1383611e55e11a3f5a.tar.gz |
some cleanups
Diffstat (limited to 'mpi/mpi-bit.c')
-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 eff7be25..cae29d22 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 |