Sun Jan 22 02:57:37 2012 UTC ()
Add CTASSERT_SIGNED() and CTASSERT_UNSIGNED().


(rmind)
diff -r1.104 -r1.105 src/sys/lib/libkern/libkern.h

cvs diff -r1.104 -r1.105 src/sys/lib/libkern/libkern.h (switch to unified diff)

--- src/sys/lib/libkern/libkern.h 2011/11/28 08:05:06 1.104
+++ src/sys/lib/libkern/libkern.h 2012/01/22 02:57:36 1.105
@@ -1,346 +1,348 @@ @@ -1,346 +1,348 @@
1/* $NetBSD: libkern.h,v 1.104 2011/11/28 08:05:06 tls Exp $ */ 1/* $NetBSD: libkern.h,v 1.105 2012/01/22 02:57:36 rmind Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1992, 1993 4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the University nor the names of its contributors 15 * 3. Neither the name of the University nor the names of its contributors
16 * may be used to endorse or promote products derived from this software 16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission. 17 * without specific prior written permission.
18 * 18 *
19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE. 29 * SUCH DAMAGE.
30 * 30 *
31 * @(#)libkern.h 8.2 (Berkeley) 8/5/94 31 * @(#)libkern.h 8.2 (Berkeley) 8/5/94
32 */ 32 */
33 33
34#ifndef _LIB_LIBKERN_LIBKERN_H_ 34#ifndef _LIB_LIBKERN_LIBKERN_H_
35#define _LIB_LIBKERN_LIBKERN_H_ 35#define _LIB_LIBKERN_LIBKERN_H_
36 36
37#include <sys/types.h> 37#include <sys/types.h>
38#include <sys/inttypes.h> 38#include <sys/inttypes.h>
39#include <sys/null.h> 39#include <sys/null.h>
40 40
41#ifndef LIBKERN_INLINE 41#ifndef LIBKERN_INLINE
42#define LIBKERN_INLINE static __inline 42#define LIBKERN_INLINE static __inline
43#define LIBKERN_BODY 43#define LIBKERN_BODY
44#endif 44#endif
45 45
46LIBKERN_INLINE int imax(int, int) __unused; 46LIBKERN_INLINE int imax(int, int) __unused;
47LIBKERN_INLINE int imin(int, int) __unused; 47LIBKERN_INLINE int imin(int, int) __unused;
48LIBKERN_INLINE u_int max(u_int, u_int) __unused; 48LIBKERN_INLINE u_int max(u_int, u_int) __unused;
49LIBKERN_INLINE u_int min(u_int, u_int) __unused; 49LIBKERN_INLINE u_int min(u_int, u_int) __unused;
50LIBKERN_INLINE long lmax(long, long) __unused; 50LIBKERN_INLINE long lmax(long, long) __unused;
51LIBKERN_INLINE long lmin(long, long) __unused; 51LIBKERN_INLINE long lmin(long, long) __unused;
52LIBKERN_INLINE u_long ulmax(u_long, u_long) __unused; 52LIBKERN_INLINE u_long ulmax(u_long, u_long) __unused;
53LIBKERN_INLINE u_long ulmin(u_long, u_long) __unused; 53LIBKERN_INLINE u_long ulmin(u_long, u_long) __unused;
54LIBKERN_INLINE int abs(int) __unused; 54LIBKERN_INLINE int abs(int) __unused;
55 55
56LIBKERN_INLINE int isspace(int) __unused; 56LIBKERN_INLINE int isspace(int) __unused;
57LIBKERN_INLINE int isascii(int) __unused; 57LIBKERN_INLINE int isascii(int) __unused;
58LIBKERN_INLINE int isupper(int) __unused; 58LIBKERN_INLINE int isupper(int) __unused;
59LIBKERN_INLINE int islower(int) __unused; 59LIBKERN_INLINE int islower(int) __unused;
60LIBKERN_INLINE int isalpha(int) __unused; 60LIBKERN_INLINE int isalpha(int) __unused;
61LIBKERN_INLINE int isdigit(int) __unused; 61LIBKERN_INLINE int isdigit(int) __unused;
62LIBKERN_INLINE int isxdigit(int) __unused; 62LIBKERN_INLINE int isxdigit(int) __unused;
63LIBKERN_INLINE int toupper(int) __unused; 63LIBKERN_INLINE int toupper(int) __unused;
64LIBKERN_INLINE int tolower(int) __unused; 64LIBKERN_INLINE int tolower(int) __unused;
65 65
66#ifdef LIBKERN_BODY 66#ifdef LIBKERN_BODY
67LIBKERN_INLINE int 67LIBKERN_INLINE int
68imax(int a, int b) 68imax(int a, int b)
69{ 69{
70 return (a > b ? a : b); 70 return (a > b ? a : b);
71} 71}
72LIBKERN_INLINE int 72LIBKERN_INLINE int
73imin(int a, int b) 73imin(int a, int b)
74{ 74{
75 return (a < b ? a : b); 75 return (a < b ? a : b);
76} 76}
77LIBKERN_INLINE long 77LIBKERN_INLINE long
78lmax(long a, long b) 78lmax(long a, long b)
79{ 79{
80 return (a > b ? a : b); 80 return (a > b ? a : b);
81} 81}
82LIBKERN_INLINE long 82LIBKERN_INLINE long
83lmin(long a, long b) 83lmin(long a, long b)
84{ 84{
85 return (a < b ? a : b); 85 return (a < b ? a : b);
86} 86}
87LIBKERN_INLINE u_int 87LIBKERN_INLINE u_int
88max(u_int a, u_int b) 88max(u_int a, u_int b)
89{ 89{
90 return (a > b ? a : b); 90 return (a > b ? a : b);
91} 91}
92LIBKERN_INLINE u_int 92LIBKERN_INLINE u_int
93min(u_int a, u_int b) 93min(u_int a, u_int b)
94{ 94{
95 return (a < b ? a : b); 95 return (a < b ? a : b);
96} 96}
97LIBKERN_INLINE u_long 97LIBKERN_INLINE u_long
98ulmax(u_long a, u_long b) 98ulmax(u_long a, u_long b)
99{ 99{
100 return (a > b ? a : b); 100 return (a > b ? a : b);
101} 101}
102LIBKERN_INLINE u_long 102LIBKERN_INLINE u_long
103ulmin(u_long a, u_long b) 103ulmin(u_long a, u_long b)
104{ 104{
105 return (a < b ? a : b); 105 return (a < b ? a : b);
106} 106}
107 107
108LIBKERN_INLINE int 108LIBKERN_INLINE int
109abs(int j) 109abs(int j)
110{ 110{
111 return(j < 0 ? -j : j); 111 return(j < 0 ? -j : j);
112} 112}
113 113
114LIBKERN_INLINE int 114LIBKERN_INLINE int
115isspace(int ch) 115isspace(int ch)
116{ 116{
117 return (ch == ' ' || (ch >= '\t' && ch <= '\r')); 117 return (ch == ' ' || (ch >= '\t' && ch <= '\r'));
118} 118}
119 119
120LIBKERN_INLINE int 120LIBKERN_INLINE int
121isascii(int ch) 121isascii(int ch)
122{ 122{
123 return ((ch & ~0x7f) == 0); 123 return ((ch & ~0x7f) == 0);
124} 124}
125 125
126LIBKERN_INLINE int 126LIBKERN_INLINE int
127isupper(int ch) 127isupper(int ch)
128{ 128{
129 return (ch >= 'A' && ch <= 'Z'); 129 return (ch >= 'A' && ch <= 'Z');
130} 130}
131 131
132LIBKERN_INLINE int 132LIBKERN_INLINE int
133islower(int ch) 133islower(int ch)
134{ 134{
135 return (ch >= 'a' && ch <= 'z'); 135 return (ch >= 'a' && ch <= 'z');
136} 136}
137 137
138LIBKERN_INLINE int 138LIBKERN_INLINE int
139isalpha(int ch) 139isalpha(int ch)
140{ 140{
141 return (isupper(ch) || islower(ch)); 141 return (isupper(ch) || islower(ch));
142} 142}
143 143
144LIBKERN_INLINE int 144LIBKERN_INLINE int
145isdigit(int ch) 145isdigit(int ch)
146{ 146{
147 return (ch >= '0' && ch <= '9'); 147 return (ch >= '0' && ch <= '9');
148} 148}
149 149
150LIBKERN_INLINE int 150LIBKERN_INLINE int
151isxdigit(int ch) 151isxdigit(int ch)
152{ 152{
153 return (isdigit(ch) || 153 return (isdigit(ch) ||
154 (ch >= 'A' && ch <= 'F') || 154 (ch >= 'A' && ch <= 'F') ||
155 (ch >= 'a' && ch <= 'f')); 155 (ch >= 'a' && ch <= 'f'));
156} 156}
157 157
158LIBKERN_INLINE int 158LIBKERN_INLINE int
159toupper(int ch) 159toupper(int ch)
160{ 160{
161 if (islower(ch)) 161 if (islower(ch))
162 return (ch - 0x20); 162 return (ch - 0x20);
163 return (ch); 163 return (ch);
164} 164}
165 165
166LIBKERN_INLINE int 166LIBKERN_INLINE int
167tolower(int ch) 167tolower(int ch)
168{ 168{
169 if (isupper(ch)) 169 if (isupper(ch))
170 return (ch + 0x20); 170 return (ch + 0x20);
171 return (ch); 171 return (ch);
172} 172}
173#endif 173#endif
174 174
175#define __NULL_STMT do { } while (/* CONSTCOND */ 0) 175#define __NULL_STMT do { } while (/* CONSTCOND */ 0)
176 176
177#define __KASSERTSTR "kernel %sassertion \"%s\" failed: file \"%s\", line %d " 177#define __KASSERTSTR "kernel %sassertion \"%s\" failed: file \"%s\", line %d "
178 178
179#ifdef NDEBUG /* tradition! */ 179#ifdef NDEBUG /* tradition! */
180#define assert(e) ((void)0) 180#define assert(e) ((void)0)
181#else 181#else
182#define assert(e) (__predict_true((e)) ? (void)0 : \ 182#define assert(e) (__predict_true((e)) ? (void)0 : \
183 kern_assert(__KASSERTSTR, "", #e, __FILE__, __LINE__)) 183 kern_assert(__KASSERTSTR, "", #e, __FILE__, __LINE__))
184#endif 184#endif
185 185
186#ifdef __COVERITY__ 186#ifdef __COVERITY__
187#ifndef DIAGNOSTIC 187#ifndef DIAGNOSTIC
188#define DIAGNOSTIC 188#define DIAGNOSTIC
189#endif 189#endif
190#endif 190#endif
191 191
192#define CTASSERT(x) __CTASSERT(x) 192#define CTASSERT(x) __CTASSERT(x)
 193#define CTASSERT_SIGNED(x) __CTASSERT(((typeof(x))-1) < 0)
 194#define CTASSERT_UNSIGNED(x) __CTASSERT(((typeof(x))-1) >= 0)
193 195
194#ifndef DIAGNOSTIC 196#ifndef DIAGNOSTIC
195#define _DIAGASSERT(a) (void)0 197#define _DIAGASSERT(a) (void)0
196#ifdef lint 198#ifdef lint
197#define KASSERTMSG(e, msg, ...) /* NOTHING */ 199#define KASSERTMSG(e, msg, ...) /* NOTHING */
198#define KASSERT(e) /* NOTHING */ 200#define KASSERT(e) /* NOTHING */
199#else /* !lint */ 201#else /* !lint */
200#define KASSERTMSG(e, msg, ...) ((void)0) 202#define KASSERTMSG(e, msg, ...) ((void)0)
201#define KASSERT(e) ((void)0) 203#define KASSERT(e) ((void)0)
202#endif /* !lint */ 204#endif /* !lint */
203#else /* DIAGNOSTIC */ 205#else /* DIAGNOSTIC */
204#define _DIAGASSERT(a) assert(a) 206#define _DIAGASSERT(a) assert(a)
205#define KASSERTMSG(e, msg, ...) \ 207#define KASSERTMSG(e, msg, ...) \
206 (__predict_true((e)) ? (void)0 : \ 208 (__predict_true((e)) ? (void)0 : \
207 kern_assert(__KASSERTSTR msg, "diagnostic ", #e, \ 209 kern_assert(__KASSERTSTR msg, "diagnostic ", #e, \
208 __FILE__, __LINE__, ## __VA_ARGS__)) 210 __FILE__, __LINE__, ## __VA_ARGS__))
209 211
210#define KASSERT(e) (__predict_true((e)) ? (void)0 : \ 212#define KASSERT(e) (__predict_true((e)) ? (void)0 : \
211 kern_assert(__KASSERTSTR, "diagnostic ", #e, \ 213 kern_assert(__KASSERTSTR, "diagnostic ", #e, \
212 __FILE__, __LINE__)) 214 __FILE__, __LINE__))
213#endif 215#endif
214 216
215#ifndef DEBUG 217#ifndef DEBUG
216#ifdef lint 218#ifdef lint
217#define KDASSERTMSG(e,msg, ...) /* NOTHING */ 219#define KDASSERTMSG(e,msg, ...) /* NOTHING */
218#define KDASSERT(e) /* NOTHING */ 220#define KDASSERT(e) /* NOTHING */
219#else /* lint */ 221#else /* lint */
220#define KDASSERTMSG(e,msg, ...) ((void)0) 222#define KDASSERTMSG(e,msg, ...) ((void)0)
221#define KDASSERT(e) ((void)0) 223#define KDASSERT(e) ((void)0)
222#endif /* lint */ 224#endif /* lint */
223#else 225#else
224#define KDASSERTMSG(e, msg, ...) \ 226#define KDASSERTMSG(e, msg, ...) \
225 (__predict_true((e)) ? (void)0 : \ 227 (__predict_true((e)) ? (void)0 : \
226 kern_assert(__KASSERTSTR msg, "debugging ", #e, \ 228 kern_assert(__KASSERTSTR msg, "debugging ", #e, \
227 __FILE__, __LINE__, ## __VA_ARGS__)) 229 __FILE__, __LINE__, ## __VA_ARGS__))
228 230
229#define KDASSERT(e) (__predict_true((e)) ? (void)0 : \ 231#define KDASSERT(e) (__predict_true((e)) ? (void)0 : \
230 kern_assert(__KASSERTSTR, "debugging ", #e, \ 232 kern_assert(__KASSERTSTR, "debugging ", #e, \
231 __FILE__, __LINE__)) 233 __FILE__, __LINE__))
232#endif 234#endif
233 235
234/* 236/*
235 * XXX: For compatibility we use SMALL_RANDOM by default. 237 * XXX: For compatibility we use SMALL_RANDOM by default.
236 */ 238 */
237#define SMALL_RANDOM 239#define SMALL_RANDOM
238 240
239#ifndef offsetof 241#ifndef offsetof
240#if __GNUC_PREREQ__(4, 0) 242#if __GNUC_PREREQ__(4, 0)
241#define offsetof(type, member) __builtin_offsetof(type, member) 243#define offsetof(type, member) __builtin_offsetof(type, member)
242#else 244#else
243#define offsetof(type, member) \ 245#define offsetof(type, member) \
244 ((size_t)(unsigned long)(&(((type *)0)->member))) 246 ((size_t)(unsigned long)(&(((type *)0)->member)))
245#endif 247#endif
246#endif 248#endif
247 249
248#define MTPRNG_RLEN 624 250#define MTPRNG_RLEN 624
249struct mtprng_state { 251struct mtprng_state {
250 unsigned int mt_idx;  252 unsigned int mt_idx;
251 uint32_t mt_elem[MTPRNG_RLEN]; 253 uint32_t mt_elem[MTPRNG_RLEN];
252 uint32_t mt_count; 254 uint32_t mt_count;
253 uint32_t mt_sparse[3]; 255 uint32_t mt_sparse[3];
254}; 256};
255 257
256/* Prototypes for which GCC built-ins exist. */ 258/* Prototypes for which GCC built-ins exist. */
257void *memcpy(void *, const void *, size_t); 259void *memcpy(void *, const void *, size_t);
258int memcmp(const void *, const void *, size_t); 260int memcmp(const void *, const void *, size_t);
259void *memset(void *, int, size_t); 261void *memset(void *, int, size_t);
260#if __GNUC_PREREQ__(2, 95) && !defined(_STANDALONE) 262#if __GNUC_PREREQ__(2, 95) && !defined(_STANDALONE)
261#define memcpy(d, s, l) __builtin_memcpy(d, s, l) 263#define memcpy(d, s, l) __builtin_memcpy(d, s, l)
262#define memcmp(a, b, l) __builtin_memcmp(a, b, l) 264#define memcmp(a, b, l) __builtin_memcmp(a, b, l)
263#endif 265#endif
264#if __GNUC_PREREQ__(2, 95) && !defined(_STANDALONE) 266#if __GNUC_PREREQ__(2, 95) && !defined(_STANDALONE)
265#define memset(d, v, l) __builtin_memset(d, v, l) 267#define memset(d, v, l) __builtin_memset(d, v, l)
266#endif 268#endif
267 269
268char *strcpy(char *, const char *); 270char *strcpy(char *, const char *);
269int strcmp(const char *, const char *); 271int strcmp(const char *, const char *);
270size_t strlen(const char *); 272size_t strlen(const char *);
271size_t strnlen(const char *, size_t); 273size_t strnlen(const char *, size_t);
272char *strsep(char **, const char *); 274char *strsep(char **, const char *);
273#if __GNUC_PREREQ__(2, 95) && !defined(_STANDALONE) 275#if __GNUC_PREREQ__(2, 95) && !defined(_STANDALONE)
274#define strcpy(d, s) __builtin_strcpy(d, s) 276#define strcpy(d, s) __builtin_strcpy(d, s)
275#define strcmp(a, b) __builtin_strcmp(a, b) 277#define strcmp(a, b) __builtin_strcmp(a, b)
276#define strlen(a) __builtin_strlen(a) 278#define strlen(a) __builtin_strlen(a)
277#endif 279#endif
278 280
279/* Functions for which we always use built-ins. */ 281/* Functions for which we always use built-ins. */
280#ifdef __GNUC__ 282#ifdef __GNUC__
281#define alloca(s) __builtin_alloca(s) 283#define alloca(s) __builtin_alloca(s)
282#endif 284#endif
283 285
284/* These exist in GCC 3.x, but we don't bother. */ 286/* These exist in GCC 3.x, but we don't bother. */
285char *strcat(char *, const char *); 287char *strcat(char *, const char *);
286char *strncpy(char *, const char *, size_t); 288char *strncpy(char *, const char *, size_t);
287int strncmp(const char *, const char *, size_t); 289int strncmp(const char *, const char *, size_t);
288char *strchr(const char *, int); 290char *strchr(const char *, int);
289char *strrchr(const char *, int); 291char *strrchr(const char *, int);
290 292
291char *strstr(const char *, const char *); 293char *strstr(const char *, const char *);
292 294
293/* 295/*
294 * ffs is an instruction on vax. 296 * ffs is an instruction on vax.
295 */ 297 */
296int ffs(int); 298int ffs(int);
297#if __GNUC_PREREQ__(2, 95) && (!defined(__vax__) || __GNUC_PREREQ__(4,1)) 299#if __GNUC_PREREQ__(2, 95) && (!defined(__vax__) || __GNUC_PREREQ__(4,1))
298#define ffs(x) __builtin_ffs(x) 300#define ffs(x) __builtin_ffs(x)
299#endif 301#endif
300 302
301void kern_assert(const char *, ...) 303void kern_assert(const char *, ...)
302 __attribute__((__format__(__printf__, 1, 2))); 304 __attribute__((__format__(__printf__, 1, 2)));
303unsigned int 305unsigned int
304 bcdtobin(unsigned int); 306 bcdtobin(unsigned int);
305unsigned int 307unsigned int
306 bintobcd(unsigned int); 308 bintobcd(unsigned int);
307u_int32_t 309u_int32_t
308 inet_addr(const char *); 310 inet_addr(const char *);
309struct in_addr; 311struct in_addr;
310int inet_aton(const char *, struct in_addr *); 312int inet_aton(const char *, struct in_addr *);
311char *intoa(u_int32_t); 313char *intoa(u_int32_t);
312#define inet_ntoa(a) intoa((a).s_addr) 314#define inet_ntoa(a) intoa((a).s_addr)
313void *memchr(const void *, int, size_t); 315void *memchr(const void *, int, size_t);
314void *memmove(void *, const void *, size_t); 316void *memmove(void *, const void *, size_t);
315int pmatch(const char *, const char *, const char **); 317int pmatch(const char *, const char *, const char **);
316#ifndef SMALL_RANDOM 318#ifndef SMALL_RANDOM
317void srandom(unsigned long); 319void srandom(unsigned long);
318char *initstate(unsigned long, char *, size_t); 320char *initstate(unsigned long, char *, size_t);
319char *setstate(char *); 321char *setstate(char *);
320#endif /* SMALL_RANDOM */ 322#endif /* SMALL_RANDOM */
321long random(void); 323long random(void);
322void mtprng_init32(struct mtprng_state *, uint32_t); 324void mtprng_init32(struct mtprng_state *, uint32_t);
323void mtprng_initarray(struct mtprng_state *, const uint32_t *, size_t); 325void mtprng_initarray(struct mtprng_state *, const uint32_t *, size_t);
324uint32_t mtprng_rawrandom(struct mtprng_state *); 326uint32_t mtprng_rawrandom(struct mtprng_state *);
325uint32_t mtprng_random(struct mtprng_state *); 327uint32_t mtprng_random(struct mtprng_state *);
326int scanc(u_int, const u_char *, const u_char *, int); 328int scanc(u_int, const u_char *, const u_char *, int);
327int skpc(int, size_t, u_char *); 329int skpc(int, size_t, u_char *);
328int strcasecmp(const char *, const char *); 330int strcasecmp(const char *, const char *);
329size_t strlcpy(char *, const char *, size_t); 331size_t strlcpy(char *, const char *, size_t);
330size_t strlcat(char *, const char *, size_t); 332size_t strlcat(char *, const char *, size_t);
331int strncasecmp(const char *, const char *, size_t); 333int strncasecmp(const char *, const char *, size_t);
332u_long strtoul(const char *, char **, int); 334u_long strtoul(const char *, char **, int);
333long long strtoll(const char *, char **, int); 335long long strtoll(const char *, char **, int);
334unsigned long long strtoull(const char *, char **, int); 336unsigned long long strtoull(const char *, char **, int);
335uintmax_t strtoumax(const char *, char **, int); 337uintmax_t strtoumax(const char *, char **, int);
336int snprintb(char *, size_t, const char *, uint64_t); 338int snprintb(char *, size_t, const char *, uint64_t);
337int snprintb_m(char *, size_t, const char *, uint64_t, size_t); 339int snprintb_m(char *, size_t, const char *, uint64_t, size_t);
338int kheapsort(void *, size_t, size_t, int (*)(const void *, const void *), 340int kheapsort(void *, size_t, size_t, int (*)(const void *, const void *),
339 void *); 341 void *);
340uint32_t crc32(uint32_t, const uint8_t *, size_t); 342uint32_t crc32(uint32_t, const uint8_t *, size_t);
341unsigned int popcount(unsigned int) __constfunc; 343unsigned int popcount(unsigned int) __constfunc;
342unsigned int popcountl(unsigned long) __constfunc; 344unsigned int popcountl(unsigned long) __constfunc;
343unsigned int popcountll(unsigned long long) __constfunc; 345unsigned int popcountll(unsigned long long) __constfunc;
344unsigned int popcount32(uint32_t) __constfunc; 346unsigned int popcount32(uint32_t) __constfunc;
345unsigned int popcount64(uint64_t) __constfunc; 347unsigned int popcount64(uint64_t) __constfunc;
346#endif /* !_LIB_LIBKERN_LIBKERN_H_ */ 348#endif /* !_LIB_LIBKERN_LIBKERN_H_ */