1*11484Sralph /* newmat.c 4.1 83/03/09 */ 2*11484Sralph /* 3*11484Sralph * newmat: return a brand new bitmat with the proper size. 4*11484Sralph * To get rid of it just call free. 5*11484Sralph */ 6*11484Sralph 7*11484Sralph #include "bit.h" 8*11484Sralph 9*11484Sralph bitmat 10*11484Sralph newmat(rows, cols) 11*11484Sralph int rows, cols; 12*11484Sralph { 13*11484Sralph int size = ((cols + 7) >> 3) * rows; 14*11484Sralph char *m; 15*11484Sralph 16*11484Sralph #ifdef TRACE 17*11484Sralph if (size <= 0 && trace) { 18*11484Sralph fprintf(trace, "newmat: rows=%d, cols=%d\n", rows, cols); 19*11484Sralph abort(); 20*11484Sralph } 21*11484Sralph if (trace) 22*11484Sralph fprintf(trace, "newmat: malloc(%d) =", size); 23*11484Sralph #endif 24*11484Sralph m = (char *) malloc(size); 25*11484Sralph #ifdef TRACE 26*11484Sralph if (trace) 27*11484Sralph fprintf(trace, "%x\n", m); 28*11484Sralph #endif 29*11484Sralph zermat(m, rows, cols); 30*11484Sralph return (m); 31*11484Sralph } 32