home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / LIBSRC.ZOO / libsrc / longlong / longlong.h < prev    next >
C/C++ Source or Header  |  1992-02-22  |  2KB  |  68 lines

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