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