scanc.c (1542) | scanc.c (1817) |
---|---|
1/*- 2 * Copyright (c) 1992, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)scanc.c 8.1 (Berkeley) 6/10/93 | 1/*- 2 * Copyright (c) 1992, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)scanc.c 8.1 (Berkeley) 6/10/93 |
34 * 35 * $Id$ |
|
34 */ 35 36#include <libkern/libkern.h> 37 38int 39scanc(size, cp, table, mask0) 40 u_int size; 41 register u_char *cp, table[]; 42 int mask0; 43{ 44 register u_char *end; 45 register u_char mask; 46 47 mask = mask0; 48 for (end = &cp[size]; cp < end && (table[*cp] & mask) == 0; ++cp); 49 return (end - cp); 50} | 36 */ 37 38#include <libkern/libkern.h> 39 40int 41scanc(size, cp, table, mask0) 42 u_int size; 43 register u_char *cp, table[]; 44 int mask0; 45{ 46 register u_char *end; 47 register u_char mask; 48 49 mask = mask0; 50 for (end = &cp[size]; cp < end && (table[*cp] & mask) == 0; ++cp); 51 return (end - cp); 52} |