param.h (0497c9b47804fe7842fef838965cb9cda66b8f6a) param.h (d846855da8c8142a2f647f7a4c6949b341261297)
1/*-
2 * Copyright (c) 1982, 1986, 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 174 unchanged lines hidden (view full) ---

183#define powerof2(x) ((((x)-1)&(x))==0)
184
185/* Macros for min/max. */
186#ifndef _KERNEL
187#define MIN(a,b) (((a)<(b))?(a):(b))
188#define MAX(a,b) (((a)>(b))?(a):(b))
189#endif
190
1/*-
2 * Copyright (c) 1982, 1986, 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 174 unchanged lines hidden (view full) ---

183#define powerof2(x) ((((x)-1)&(x))==0)
184
185/* Macros for min/max. */
186#ifndef _KERNEL
187#define MIN(a,b) (((a)<(b))?(a):(b))
188#define MAX(a,b) (((a)>(b))?(a):(b))
189#endif
190
191#ifdef _KERNEL
192/*
191/*
193 * Extended byte order support functions, for kernel use only currently.
194 * First, generic implementation of the byte swapping functions for those
195 * architectures that do not have optimized variants of each.
192 * Basic byte order function prototypes for non-inline functions.
193 *
194 * XXX temporarily exposed to userland for bogus software.
196 */
195 */
197#ifndef _BSWAP16_DEFINED
198#define _BSWAP16_DEFINED
199static __inline __uint16_t
200__bswap16(__uint16_t x)
201{
202 return ((x >> 8) | ((x << 8) & 0xff00U));
203}
196#ifndef _BYTEORDER_PROTOTYPED
197#define _BYTEORDER_PROTOTYPED
198__BEGIN_DECLS
199__uint32_t htonl __P((__uint32_t));
200__uint16_t htons __P((__uint16_t));
201__uint32_t ntohl __P((__uint32_t));
202__uint16_t ntohs __P((__uint16_t));
203__END_DECLS
204#endif
205
204#endif
205
206#ifndef _BSWAP32_DEFINED
207#define _BSWAP32_DEFINED
208static __inline __uint32_t
209__bswap32(__uint32_t x)
210{
211 return ((x >> 24) | ((x >> 8) & 0xff00U) | ((x << 8) & 0xff0000U) |
212 ((x << 24) & 0xff000000U));
213}
214#endif
206/* XXX temporarily exposed to userland for bogus software. */
207#ifndef _BYTEORDER_FUNC_DEFINED
208#define _BYTEORDER_FUNC_DEFINED
209#define htonl(x) __htonl(x)
210#define htons(x) __htons(x)
211#define ntohl(x) __ntohl(x)
212#define ntohs(x) __ntohs(x)
213#endif /* !_BYTEORDER_FUNC_DEFINED */
215
214
216#ifndef _BSWAP64_DEFINED
217#define _BSWAP64_DEFINED
218static __inline __uint64_t
219__bswap64(__uint64_t x)
220{
221 return ((x >> 56) | ((x >> 40) & 0xff00UL) | ((x >> 24) & 0xff0000UL) |
222 ((x >> 8) & 0xff000000UL) | ((x << 8) & 0xff00000000UL) |
223 ((x << 24) & 0xff0000000000UL) | ((x << 40) & 0xff000000000000UL) |
224 ((x << 56)));
225}
226#endif
227
215#ifdef _KERNEL
228#define bswap16(x) __bswap16(x)
229#define bswap32(x) __bswap32(x)
230#define bswap64(x) __bswap64(x)
231
232#if BYTE_ORDER == LITTLE_ENDIAN
233#define htobe16(x) bswap16((x))
234#define htobe32(x) bswap32((x))
235#define htobe64(x) bswap64((x))

--- 18 unchanged lines hidden (view full) ---

254#define be16toh(x) ((__uint16_t)(x))
255#define be32toh(x) ((__uint32_t)(x))
256#define be64toh(x) ((__uint64_t)(x))
257#define le16toh(x) bswap16((x))
258#define le32toh(x) bswap32((x))
259#define le64toh(x) bswap64((x))
260#endif /* BYTE_ORDER */
261
216#define bswap16(x) __bswap16(x)
217#define bswap32(x) __bswap32(x)
218#define bswap64(x) __bswap64(x)
219
220#if BYTE_ORDER == LITTLE_ENDIAN
221#define htobe16(x) bswap16((x))
222#define htobe32(x) bswap32((x))
223#define htobe64(x) bswap64((x))

--- 18 unchanged lines hidden (view full) ---

242#define be16toh(x) ((__uint16_t)(x))
243#define be32toh(x) ((__uint32_t)(x))
244#define be64toh(x) ((__uint64_t)(x))
245#define le16toh(x) bswap16((x))
246#define le32toh(x) bswap32((x))
247#define le64toh(x) bswap64((x))
248#endif /* BYTE_ORDER */
249
262#define htonl(x) htobe32((x))
263#define htons(x) htobe16((x))
264#define ntohl(x) be32toh((x))
265#define ntohs(x) be16toh((x))
266
267#endif /* _KERNEL */
268
269/*
270 * Constants for setting the parameters of the kernel memory allocator.
271 *
272 * 2 ** MINBUCKET is the smallest unit of memory that will be
273 * allocated. It must be at least large enough to hold a pointer.
274 *

--- 37 unchanged lines hidden ---
250#endif /* _KERNEL */
251
252/*
253 * Constants for setting the parameters of the kernel memory allocator.
254 *
255 * 2 ** MINBUCKET is the smallest unit of memory that will be
256 * allocated. It must be at least large enough to hold a pointer.
257 *

--- 37 unchanged lines hidden ---