aboutsummaryrefslogtreecommitdiffstats
path: root/mpi
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--mpi/ChangeLog5
-rw-r--r--mpi/mpicoder.c9
2 files changed, 12 insertions, 2 deletions
diff --git a/mpi/ChangeLog b/mpi/ChangeLog
index 5a2f03997..ca01cb4d8 100644
--- a/mpi/ChangeLog
+++ b/mpi/ChangeLog
@@ -1,3 +1,8 @@
+Mon Apr 6 12:38:52 1998 Werner Koch ([email protected])
+
+ * mpicoder.c (mpi_get_buffer): Removed returned leading zeroes
+ and changed all callers.
+
Tue Mar 10 13:40:34 1998 Werner Koch ([email protected])
* mpi-bit.c (mpi_clear_highbit): New.
diff --git a/mpi/mpicoder.c b/mpi/mpicoder.c
index 4d3f454ac..9362aff65 100644
--- a/mpi/mpicoder.c
+++ b/mpi/mpicoder.c
@@ -54,8 +54,6 @@ mpi_write( IOBUF out, MPI a )
iobuf_put(out, (nbits) );
p = buf = mpi_get_buffer( a, &n, NULL );
- for( ; !*p && n; p++, n-- )
- ;
rc = iobuf_write( out, p, n );
m_free(buf);
return rc;
@@ -302,6 +300,13 @@ mpi_get_buffer( MPI a, unsigned *nbytes, int *sign )
#error please implement for this limb size.
#endif
}
+
+ /* this is sub-optimal but we need to do the shift oepration because
+ * the caller has to free the returned buffer */
+ for(p=buffer; !*p && *nbytes; p++, --*nbytes )
+ ;
+ if( p != buffer )
+ memmove(buffer,p, *nbytes);
return buffer;
}