1 /*-
2  * Copyright (c) 1988 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)general.h	4.2 (Berkeley) 04/26/91
8  */
9 
10 /*
11  * Some general definitions.
12  */
13 
14 #define	numberof(x)	(sizeof x/sizeof x[0])
15 #define	highestof(x)	(numberof(x)-1)
16 
17 #if	defined(unix)
18 #define	ClearElement(x)		bzero((char *)&x, sizeof x)
19 #define	ClearArray(x)		bzero((char *)x, sizeof x)
20 #else	/* defined(unix) */
21 #define	ClearElement(x)		memset((char *)&x, 0, sizeof x)
22 #define	ClearArray(x)		memset((char *)x, 0, sizeof x)
23 #endif	/* defined(unix) */
24 
25 #if	defined(unix)		/* Define BSD equivalent mem* functions */
26 #define	memcpy(dest,src,n)	bcopy(src,dest,n)
27 #define	memmove(dest,src,n)	bcopy(src,dest,n)
28 #define	memset(s,c,n)		if (c == 0) { \
29 				    bzero(s,n); \
30 				} else { \
31 				    register char *src = s; \
32 				    register int count = n; \
33 					\
34 				    while (count--) { \
35 					*src++ = c; \
36 				    } \
37 				}
38 #define	memcmp(s1,s2,n)		bcmp(s1,s2,n)
39 #endif	/* defined(unix) */
40