153439Sbostic /*- 253439Sbostic * Copyright (c) 1992 The Regents of the University of California. 353439Sbostic * All rights reserved. 453439Sbostic * 553439Sbostic * %sccs.include.redist.c% 653439Sbostic * 7*53453Sbostic * @(#)quad.h 5.2 (Berkeley) 05/12/92 853439Sbostic */ 953439Sbostic 1053439Sbostic /* More subroutines needed by GCC output code on some machines. */ 1153439Sbostic /* Compile this one with gcc. */ 12*53453Sbostic #include <sys/param.h> 1353439Sbostic 1453439Sbostic #include <stddef.h> 1553439Sbostic 16*53453Sbostic #define BITS_PER_WORD (NBBY * sizeof(long)) 17*53453Sbostic 1853439Sbostic #ifndef SItype 1953439Sbostic #define SItype long int 2053439Sbostic #endif 2153439Sbostic 2253439Sbostic /* long long ints are pairs of long ints in the order determined by 2353439Sbostic WORDS_BIG_ENDIAN. */ 2453439Sbostic 2553439Sbostic #ifdef WORDS_BIG_ENDIAN 2653439Sbostic struct longlong {long high, low;}; 2753439Sbostic #else 2853439Sbostic struct longlong {long low, high;}; 2953439Sbostic #endif 3053439Sbostic 3153439Sbostic /* We need this union to unpack/pack longlongs, since we don't have 3253439Sbostic any arithmetic yet. Incoming long long parameters are stored 3353439Sbostic into the `ll' field, and the unpacked result is read from the struct 3453439Sbostic longlong. */ 3553439Sbostic 3653439Sbostic typedef union 3753439Sbostic { 3853439Sbostic struct longlong s; 3953439Sbostic long long ll; 4053439Sbostic SItype i[2]; 4153439Sbostic unsigned SItype ui[2]; 4253439Sbostic } long_long; 4353439Sbostic 4453439Sbostic /* Internally, long long ints are strings of unsigned shorts in the 4553439Sbostic order determined by BYTES_BIG_ENDIAN. */ 4653439Sbostic 4753439Sbostic #define B 0x10000 4853439Sbostic #define low16 (B - 1) 4953439Sbostic 5053439Sbostic #ifdef BYTES_BIG_ENDIAN 5153439Sbostic 5253439Sbostic /* Note that HIGH and LOW do not describe the order 5353439Sbostic of words in a long long. They describe the order of words 5453439Sbostic in vectors ordered according to the byte order. */ 5553439Sbostic 5653439Sbostic #define HIGH 0 5753439Sbostic #define LOW 1 5853439Sbostic 5953439Sbostic #define big_end(n) 0 6053439Sbostic #define little_end(n) ((n) - 1) 6153439Sbostic #define next_msd(i) ((i) - 1) 6253439Sbostic #define next_lsd(i) ((i) + 1) 6353439Sbostic #define is_not_msd(i,n) ((i) >= 0) 6453439Sbostic #define is_not_lsd(i,n) ((i) < (n)) 6553439Sbostic 6653439Sbostic #else 6753439Sbostic 6853439Sbostic #define LOW 0 6953439Sbostic #define HIGH 1 7053439Sbostic 7153439Sbostic #define big_end(n) ((n) - 1) 7253439Sbostic #define little_end(n) 0 7353439Sbostic #define next_msd(i) ((i) + 1) 7453439Sbostic #define next_lsd(i) ((i) - 1) 7553439Sbostic #define is_not_msd(i,n) ((i) < (n)) 7653439Sbostic #define is_not_lsd(i,n) ((i) >= 0) 7753439Sbostic 7853439Sbostic #endif 79