xref: /csrg-svn/sys/libkern/libkern.h (revision 55076)
154183Sbostic /*-
254183Sbostic  * Copyright (c) 1992 The Regents of the University of California.
354183Sbostic  * All rights reserved.
454183Sbostic  *
554183Sbostic  * %sccs.include.redist.c%
654183Sbostic  *
7*55076Sbostic  *	@(#)libkern.h	7.4 (Berkeley) 07/12/92
854183Sbostic  */
954183Sbostic 
1054184Sbostic #include <sys/types.h>
1154184Sbostic 
12*55076Sbostic static inline int
13*55076Sbostic imax(a, b)
14*55076Sbostic 	int a, b;
15*55076Sbostic {
16*55076Sbostic 	return (a > b ? a : b);
17*55076Sbostic }
18*55076Sbostic static inline int
19*55076Sbostic imin(a, b)
20*55076Sbostic 	int a, b;
21*55076Sbostic {
22*55076Sbostic 	return (a < b ? a : b);
23*55076Sbostic }
24*55076Sbostic static inline long
25*55076Sbostic lmax(a, b)
26*55076Sbostic 	long a, b;
27*55076Sbostic {
28*55076Sbostic 	return (a > b ? a : b);
29*55076Sbostic }
30*55076Sbostic static inline long
31*55076Sbostic lmin(a, b)
32*55076Sbostic 	long a, b;
33*55076Sbostic {
34*55076Sbostic 	return (a < b ? a : b);
35*55076Sbostic }
36*55076Sbostic static inline u_int
37*55076Sbostic max(a, b)
38*55076Sbostic 	u_int a, b;
39*55076Sbostic {
40*55076Sbostic 	return (a > b ? a : b);
41*55076Sbostic }
42*55076Sbostic static inline u_int
43*55076Sbostic min(a, b)
44*55076Sbostic 	u_int a, b;
45*55076Sbostic {
46*55076Sbostic 	return (a < b ? a : b);
47*55076Sbostic }
48*55076Sbostic static inline u_long
49*55076Sbostic ulmax(a, b)
50*55076Sbostic 	u_long a, b;
51*55076Sbostic {
52*55076Sbostic 	return (a > b ? a : b);
53*55076Sbostic }
54*55076Sbostic static inline u_long
55*55076Sbostic ulmin(a, b)
56*55076Sbostic 	u_long a, b;
57*55076Sbostic {
58*55076Sbostic 	return (a < b ? a : b);
59*55076Sbostic }
60*55076Sbostic 
6154183Sbostic /* Prototypes for non-quad routines. */
6254183Sbostic int	 bcmp __P((const void *, const void *, size_t));
6354183Sbostic int	 ffs __P((int));
6454184Sbostic int	 locc __P((int, char *, u_int));
6554354Storek u_long	 random __P((void));
6654184Sbostic int	 scanc __P((u_int, u_char *, u_char *, int));
6754184Sbostic int	 skpc __P((int, int, char *));
6854183Sbostic char	*strcat __P((char *, const char *));
6954183Sbostic char	*strcpy __P((char *, const char *));
7054183Sbostic size_t	 strlen __P((const char *));
7154183Sbostic char	*strncpy __P((char *, const char *, size_t));
72