date and time created 83/03/09 16:23:02 by ralph
authorRalph Campbell <ralph@ucbvax.Berkeley.EDU>
Thu, 10 Mar 1983 08:23:02 +0000 (00:23 -0800)
committerRalph Campbell <ralph@ucbvax.Berkeley.EDU>
Thu, 10 Mar 1983 08:23:02 +0000 (00:23 -0800)
SCCS-vsn: old/lib2648/newmat.c 4.1

usr/src/old/lib2648/newmat.c [new file with mode: 0644]

diff --git a/usr/src/old/lib2648/newmat.c b/usr/src/old/lib2648/newmat.c
new file mode 100644 (file)
index 0000000..bd2b1a4
--- /dev/null
@@ -0,0 +1,31 @@
+/*     newmat.c        4.1     83/03/09        */
+/*
+ * newmat: return a brand new bitmat with the proper size.
+ * To get rid of it just call free.
+ */
+
+#include "bit.h"
+
+bitmat
+newmat(rows, cols)
+int rows, cols;
+{
+       int size = ((cols + 7) >> 3) * rows;
+       char *m;
+
+#ifdef TRACE
+       if (size <= 0 && trace) {
+               fprintf(trace, "newmat: rows=%d, cols=%d\n", rows, cols);
+               abort();
+       }
+       if (trace)
+               fprintf(trace, "newmat: malloc(%d) =", size);
+#endif
+       m = (char *) malloc(size);
+#ifdef TRACE
+       if (trace)
+               fprintf(trace, "%x\n", m);
+#endif
+       zermat(m, rows, cols);
+       return (m);
+}