175831Sasmodai/*	$NetBSD: param.h,v 1.4 1995/07/23 18:14:41 ragge Exp $	*/
212099Sjoerg
312099Sjoerg/*
412099Sjoerg * Copyright (c) 1994, 1995 Jochen Pohl
512099Sjoerg * All Rights Reserved.
612099Sjoerg *
712099Sjoerg * Redistribution and use in source and binary forms, with or without
812099Sjoerg * modification, are permitted provided that the following conditions
912099Sjoerg * are met:
1012099Sjoerg * 1. Redistributions of source code must retain the above copyright
1112099Sjoerg *    notice, this list of conditions and the following disclaimer.
1212099Sjoerg * 2. Redistributions in binary form must reproduce the above copyright
1312099Sjoerg *    notice, this list of conditions and the following disclaimer in the
1412099Sjoerg *    documentation and/or other materials provided with the distribution.
1512099Sjoerg * 3. All advertising materials mentioning features or use of this software
1612099Sjoerg *    must display the following acknowledgement:
1712099Sjoerg *      This product includes software developed by Jochen Pohl for
1812099Sjoerg *	The NetBSD Project.
1912099Sjoerg * 4. The name of the author may not be used to endorse or promote products
2012099Sjoerg *    derived from this software without specific prior written permission.
2112099Sjoerg *
2212099Sjoerg * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2312099Sjoerg * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
2412099Sjoerg * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2512099Sjoerg * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2612099Sjoerg * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2712099Sjoerg * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2812099Sjoerg * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2912099Sjoerg * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3012099Sjoerg * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
3112099Sjoerg * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3275730Sasmodai *
3375730Sasmodai * $FreeBSD$
3412099Sjoerg */
3512099Sjoerg
3612099Sjoerg/*
3712099Sjoerg * Minimun size of string buffer. If this is not enough, the buffer
3812099Sjoerg * is enlarged in steps of STRBLEN bytes.
3912099Sjoerg */
4012099Sjoerg#define	STRBLEN		256
4112099Sjoerg
4212099Sjoerg/*
4312099Sjoerg * This defines the size of memory blocks which are used to allocate
4412099Sjoerg * memory in larger chunks.
4512099Sjoerg */
4612099Sjoerg#define	MBLKSIZ		((size_t)0x4000)
4712099Sjoerg
4812099Sjoerg/*
4912099Sjoerg * Sizes of hash tables
5012099Sjoerg * Should be a prime. Possible primes are
5112099Sjoerg * 307, 401, 503, 601, 701, 809, 907, 1009, 1103, 1201, 1301, 1409, 1511.
5212099Sjoerg *
5312099Sjoerg * HSHSIZ1	symbol table 1st pass
5412099Sjoerg * HSHSIZ2	symbol table 2nd pass
5512099Sjoerg * THSHSIZ2	type table 2nd pass
5612099Sjoerg */
5712099Sjoerg#define	HSHSIZ1		503
5812099Sjoerg#define HSHSIZ2		1009
5912099Sjoerg#define	THSHSIZ2	1009
6012099Sjoerg
6112099Sjoerg/*
6212099Sjoerg * Should be set to 1 if the difference of two pointers is of type long
6312099Sjoerg * or the value of sizeof is of type unsigned long.
6412099Sjoerg */
65268351Smarcel#if __amd64__
6612099Sjoerg#define PTRDIFF_IS_LONG		1
6712099Sjoerg#define SIZEOF_IS_ULONG		1
6884734Sdfr#elif __alpha__
6984734Sdfr#define PTRDIFF_IS_LONG		1
7084734Sdfr#define SIZEOF_IS_ULONG		1
7112099Sjoerg#elif __i386__
7212099Sjoerg#define PTRDIFF_IS_LONG		0
7312099Sjoerg#define SIZEOF_IS_ULONG		0
7412099Sjoerg#elif __m68k__
7512099Sjoerg#define PTRDIFF_IS_LONG		0
7612099Sjoerg#define SIZEOF_IS_ULONG		0
7712099Sjoerg#elif __ns32k__
7812099Sjoerg#define PTRDIFF_IS_LONG		0
7912099Sjoerg#define SIZEOF_IS_ULONG		0
80107716Sbenno#elif __powerpc__
81107716Sbenno#define PTRDIFF_IS_LONG		0
82107716Sbenno#define SIZEOF_IS_ULONG		0
83294571Sbr#elif __riscv__
84294571Sbr#define PTRDIFF_IS_LONG		1
85294571Sbr#define SIZEOF_IS_ULONG		1
8612099Sjoerg#elif __sparc__
8712099Sjoerg#define PTRDIFF_IS_LONG		0
8812099Sjoerg#define SIZEOF_IS_ULONG		0
8991977Sjake#elif __sparc64__
9091977Sjake#define PTRDIFF_IS_LONG		1
9191977Sjake#define SIZEOF_IS_ULONG		1
9212099Sjoerg#elif __vax__
9312099Sjoerg#define PTRDIFF_IS_LONG         0
9412099Sjoerg#define SIZEOF_IS_ULONG         0
95129223Scognet#elif __arm__
96129223Scognet#define PTRDIFF_IS_LONG		0
97129223Scognet#define SIZEOF_IS_ULONG		0
98177927Simp#elif __mips__
99177927Simp#define PTRDIFF_IS_LONG		0
100177927Simp#define SIZEOF_IS_ULONG		0
101280218Semaste#elif __aarch64__
102280218Semaste#define PTRDIFF_IS_LONG		1
103280218Semaste#define SIZEOF_IS_ULONG		1
10412099Sjoerg#else
10512099Sjoerg#error unknown machine type
10612099Sjoerg#endif
10712099Sjoerg
10812099Sjoerg/*
10912099Sjoerg * Make sure this matches wchar_t.
11012099Sjoerg */
11112099Sjoerg#define WCHAR	SHORT
11212099Sjoerg
11312099Sjoerg#ifndef __GNUC__
11412099Sjoerg#ifndef lint
11512099Sjoerg#ifndef QUAD_MAX	/* necessary for mkdep */
11612099Sjoerg#define QUAD_MAX	LONG_MAX
11712099Sjoerg#define QUAD_MIN	LONG_MIN
11812099Sjoerg#define UQUAD_MAX	ULONG_MAX
11912099Sjoerg#endif
12012099Sjoergtypedef	long	quad_t;
12112099Sjoergtypedef	u_long	u_quad_t;
12212099Sjoerg#endif
12312099Sjoerg#endif
12412099Sjoerg
12512099Sjoerg
12612099Sjoerg/*
12712099Sjoerg * long double only in ANSI C.
12812099Sjoerg */
12912099Sjoerg#ifdef __STDC__
13012099Sjoergtypedef	long double ldbl_t;
13112099Sjoerg#else
13212099Sjoergtypedef	double	ldbl_t;
13312099Sjoerg#endif
13412099Sjoerg
13512099Sjoerg/*
13612099Sjoerg * Some traditional compilers are not able to assign structures.
13712099Sjoerg */
13812099Sjoerg#ifdef __STDC__
13912099Sjoerg#define STRUCT_ASSIGN(dest, src)	(dest) = (src)
14012099Sjoerg#else
14112099Sjoerg#define STRUCT_ASSIGN(dest, src)	(void)memcpy(&(dest), &(src), \
14212099Sjoerg						     sizeof (dest));
14312099Sjoerg#endif
144