aboutsummaryrefslogtreecommitdiffstats
path: root/mpi
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--mpi/ChangeLog4
-rw-r--r--mpi/mpi-bit.c19
2 files changed, 23 insertions, 0 deletions
diff --git a/mpi/ChangeLog b/mpi/ChangeLog
index ddcfce751..5a2f03997 100644
--- a/mpi/ChangeLog
+++ b/mpi/ChangeLog
@@ -1,3 +1,7 @@
+Tue Mar 10 13:40:34 1998 Werner Koch ([email protected])
+
+ * mpi-bit.c (mpi_clear_highbit): New.
+
Mon Mar 2 19:29:00 1998 Werner Koch ([email protected])
* Makefile.am (DISTCLEANFILES): New
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