From 6b91e7762c65097a103b2b17db304a4d85b3573d Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 19 Mar 1998 15:27:29 +0000 Subject: some cleanups --- mpi/mpi-bit.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'mpi/mpi-bit.c') 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 @@ -134,6 +134,25 @@ mpi_set_highbit( MPI a, unsigned n ) a->nlimbs = limbno+1; } +/**************** + * 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. */ -- cgit v1.2.3