xref: /csrg-svn/lib/libc/quad/quad.h (revision 53459)
153439Sbostic /*-
253439Sbostic  * Copyright (c) 1992 The Regents of the University of California.
353439Sbostic  * All rights reserved.
453439Sbostic  *
553439Sbostic  * %sccs.include.redist.c%
653439Sbostic  *
7*53459Sbostic  *	@(#)quad.h	5.4 (Berkeley) 05/12/92
853439Sbostic  */
953439Sbostic 
10*53459Sbostic /* Copyright (C) 1989, 1992 Free Software Foundation, Inc.
11*53459Sbostic 
12*53459Sbostic This file is part of GNU CC.
13*53459Sbostic 
14*53459Sbostic GNU CC is free software; you can redistribute it and/or modify
15*53459Sbostic it under the terms of the GNU General Public License as published by
16*53459Sbostic the Free Software Foundation; either version 2, or (at your option)
17*53459Sbostic any later version.
18*53459Sbostic 
19*53459Sbostic GNU CC is distributed in the hope that it will be useful,
20*53459Sbostic but WITHOUT ANY WARRANTY; without even the implied warranty of
21*53459Sbostic MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22*53459Sbostic GNU General Public License for more details.
23*53459Sbostic 
24*53459Sbostic You should have received a copy of the GNU General Public License
25*53459Sbostic along with GNU CC; see the file COPYING.  If not, write to
26*53459Sbostic the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
27*53459Sbostic 
28*53459Sbostic /* As a special exception, if you link this library with files
29*53459Sbostic    compiled with GCC to produce an executable, this does not cause
30*53459Sbostic    the resulting executable to be covered by the GNU General Public License.
31*53459Sbostic    This exception does not however invalidate any other reasons why
32*53459Sbostic    the executable file might be covered by the GNU General Public License.  */
33*53459Sbostic 
3453439Sbostic /* More subroutines needed by GCC output code on some machines.  */
3553439Sbostic /* Compile this one with gcc.  */
3653453Sbostic #include <sys/param.h>
3753439Sbostic 
3853453Sbostic #define	BITS_PER_WORD	(NBBY * sizeof(long))
3953453Sbostic 
4053439Sbostic /* We need this union to unpack/pack longlongs, since we don't have
4153439Sbostic    any arithmetic yet.  Incoming long long parameters are stored
4253439Sbostic    into the `ll' field, and the unpacked result is read from the struct
4353439Sbostic    longlong.  */
4453439Sbostic 
4553456Sbostic typedef union {
4653456Sbostic 	long long ll;
4753456Sbostic 	struct { long val[2]; } s;
4853439Sbostic } long_long;
4953456Sbostic #define high val[_QUAD_HIGHWORD]
5053456Sbostic #define low val[_QUAD_LOWWORD]
5153439Sbostic 
5253456Sbostic #define HIGH _QUAD_HIGHWORD
5353456Sbostic #define LOW _QUAD_LOWWORD
5453456Sbostic 
5553439Sbostic /* Internally, long long ints are strings of unsigned shorts in the
5653456Sbostic    order determined by BYTE_ORDER.  */
5753439Sbostic 
5853439Sbostic #define B 0x10000
5953439Sbostic #define low16 (B - 1)
6053439Sbostic 
6153456Sbostic #if BYTE_ORDER == BIG_ENDIAN
6253439Sbostic #define big_end(n)	0
6353439Sbostic #define little_end(n)	((n) - 1)
6453439Sbostic #define next_msd(i)	((i) - 1)
6553439Sbostic #define next_lsd(i)	((i) + 1)
6653439Sbostic #define is_not_msd(i,n)	((i) >= 0)
6753439Sbostic #define is_not_lsd(i,n)	((i) < (n))
6853439Sbostic #else
6953439Sbostic #define big_end(n)	((n) - 1)
7053439Sbostic #define little_end(n)	0
7153439Sbostic #define next_msd(i)	((i) + 1)
7253439Sbostic #define next_lsd(i)	((i) - 1)
7353439Sbostic #define is_not_msd(i,n)	((i) < (n))
7453439Sbostic #define is_not_lsd(i,n)	((i) >= 0)
7553439Sbostic #endif
76