xref: /csrg-svn/old/lib2648/emptyrow.c (revision 19788)
111471Sralph /*
2*19788Sdist  * Copyright (c) 1980 Regents of the University of California.
3*19788Sdist  * All rights reserved.  The Berkeley software License Agreement
4*19788Sdist  * specifies the terms and conditions for redistribution.
5*19788Sdist  */
6*19788Sdist 
7*19788Sdist #ifndef lint
8*19788Sdist static char sccsid[] = "@(#)emptyrow.c	5.1 (Berkeley) 04/30/85";
9*19788Sdist #endif not lint
10*19788Sdist 
11*19788Sdist /*
1211471Sralph  * emptyrow: returns true if row r of m is all zeros.
1311471Sralph  *
1411471Sralph  * Note that we assume the garbage at the end of the
1511471Sralph  * row is all zeros.
1611471Sralph  */
1711471Sralph 
1811471Sralph #include "bit.h"
1911471Sralph 
emptyrow(m,rows,cols,r)2011471Sralph emptyrow(m, rows, cols, r)
2111471Sralph bitmat m;
2211471Sralph int rows, cols, r;
2311471Sralph {
2411471Sralph 	char *top, *bot;
2511471Sralph 
2611471Sralph 	bot = &m[r*((cols+7)>>3)];
2711471Sralph 	top = bot + ((cols-1) >> 3);
2811471Sralph 	while (bot <= top)
2911471Sralph 		if (*bot++)
3011471Sralph 			return(0);
3111471Sralph 	return (1);
3211471Sralph }
33