xref: /csrg-svn/lib/libc/quad/quad.h (revision 53439)
1*53439Sbostic /*-
2*53439Sbostic  * Copyright (c) 1992 The Regents of the University of California.
3*53439Sbostic  * All rights reserved.
4*53439Sbostic  *
5*53439Sbostic  * %sccs.include.redist.c%
6*53439Sbostic  *
7*53439Sbostic  *	@(#)quad.h	5.1 (Berkeley) 05/12/92
8*53439Sbostic  */
9*53439Sbostic 
10*53439Sbostic /* More subroutines needed by GCC output code on some machines.  */
11*53439Sbostic /* Compile this one with gcc.  */
12*53439Sbostic 
13*53439Sbostic #include "config.h"
14*53439Sbostic #include <stddef.h>
15*53439Sbostic 
16*53439Sbostic #ifndef SItype
17*53439Sbostic #define SItype long int
18*53439Sbostic #endif
19*53439Sbostic 
20*53439Sbostic /* long long ints are pairs of long ints in the order determined by
21*53439Sbostic    WORDS_BIG_ENDIAN.  */
22*53439Sbostic 
23*53439Sbostic #ifdef WORDS_BIG_ENDIAN
24*53439Sbostic   struct longlong {long high, low;};
25*53439Sbostic #else
26*53439Sbostic   struct longlong {long low, high;};
27*53439Sbostic #endif
28*53439Sbostic 
29*53439Sbostic /* We need this union to unpack/pack longlongs, since we don't have
30*53439Sbostic    any arithmetic yet.  Incoming long long parameters are stored
31*53439Sbostic    into the `ll' field, and the unpacked result is read from the struct
32*53439Sbostic    longlong.  */
33*53439Sbostic 
34*53439Sbostic typedef union
35*53439Sbostic {
36*53439Sbostic   struct longlong s;
37*53439Sbostic   long long ll;
38*53439Sbostic   SItype i[2];
39*53439Sbostic   unsigned SItype ui[2];
40*53439Sbostic } long_long;
41*53439Sbostic 
42*53439Sbostic /* Internally, long long ints are strings of unsigned shorts in the
43*53439Sbostic    order determined by BYTES_BIG_ENDIAN.  */
44*53439Sbostic 
45*53439Sbostic #define B 0x10000
46*53439Sbostic #define low16 (B - 1)
47*53439Sbostic 
48*53439Sbostic #ifdef BYTES_BIG_ENDIAN
49*53439Sbostic 
50*53439Sbostic /* Note that HIGH and LOW do not describe the order
51*53439Sbostic    of words in a long long.  They describe the order of words
52*53439Sbostic    in vectors ordered according to the byte order.  */
53*53439Sbostic 
54*53439Sbostic #define HIGH 0
55*53439Sbostic #define LOW 1
56*53439Sbostic 
57*53439Sbostic #define big_end(n)	0
58*53439Sbostic #define little_end(n)	((n) - 1)
59*53439Sbostic #define next_msd(i)	((i) - 1)
60*53439Sbostic #define next_lsd(i)	((i) + 1)
61*53439Sbostic #define is_not_msd(i,n)	((i) >= 0)
62*53439Sbostic #define is_not_lsd(i,n)	((i) < (n))
63*53439Sbostic 
64*53439Sbostic #else
65*53439Sbostic 
66*53439Sbostic #define LOW 0
67*53439Sbostic #define HIGH 1
68*53439Sbostic 
69*53439Sbostic #define big_end(n)	((n) - 1)
70*53439Sbostic #define little_end(n)	0
71*53439Sbostic #define next_msd(i)	((i) + 1)
72*53439Sbostic #define next_lsd(i)	((i) - 1)
73*53439Sbostic #define is_not_msd(i,n)	((i) < (n))
74*53439Sbostic #define is_not_lsd(i,n)	((i) >= 0)
75*53439Sbostic 
76*53439Sbostic #endif
77