home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / np40sdk.exe / NP40SDK.OS2 / include / jri_md.h < prev    next >
Text File  |  1998-09-23  |  27KB  |  510 lines

  1. /* -*- Mode: C; tab-width: 4; -*- */
  2. /*******************************************************************************
  3.  * Java Runtime Interface - Machine Dependent Types
  4.  * Copyright (c) 1996 Netscape Communications Corporation. All rights reserved.
  5.  ******************************************************************************/
  6.  
  7. #ifndef JRI_MD_H
  8. #define JRI_MD_H
  9.  
  10. #include <assert.h>
  11.  
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15.  
  16. /*******************************************************************************
  17.  * WHAT'S UP WITH THIS FILE?
  18.  *
  19.  * This is where we define the mystical JRI_PUBLIC_API macro that works on all
  20.  * platforms. If you're running with Visual C++, Symantec C, or Borland's
  21.  * development environment on the PC, you're all set. Or if you're on the Mac
  22.  * with Metrowerks, Symantec or MPW with SC you're ok too. For UNIX it shouldn't
  23.  * matter.
  24.  *
  25.  * On UNIX though you probably care about a couple of other symbols though:
  26.  *      IS_LITTLE_ENDIAN must be defined for little-endian systems
  27.  *      HAVE_LONG_LONG must be defined on systems that have 'long long' integers
  28.  *      HAVE_ALIGNED_LONGLONGS must be defined if long-longs must be 8 byte aligned
  29.  *      HAVE_ALIGNED_DOUBLES must be defined if doubles must be 8 byte aligned
  30.  *      IS_64 must be defined on 64-bit machines (like Dec Alpha)
  31.  ******************************************************************************/
  32.  
  33. /* DLL Entry modifiers... */
  34.  
  35. /* PC */
  36. #if defined(XP_OS2)
  37. #       define JRI_PUBLIC_API(ResultType)       ResultType _Optlink
  38. #       define JRI_PUBLIC_VAR(VarType)          VarType
  39. #       define JRI_NATIVE_STUB(ResultType)      ResultType _Optlink
  40. #       define JRI_CALLBACK                                     _System
  41. #       ifndef IS_LITTLE_ENDIAN
  42. #               define IS_LITTLE_ENDIAN 1
  43. #       endif
  44. #elif defined(XP_PC) || defined(_WINDOWS) || defined(WIN32) || defined(_WIN32)
  45. #       include <windows.h>
  46. #       if defined(_MSC_VER)
  47. #               if defined(WIN32) || defined(_WIN32)
  48. #                       define JRI_PUBLIC_API(ResultType)       _declspec(dllexport) ResultType
  49. #                       define JRI_PUBLIC_VAR(VarType)          VarType
  50. #                       define JRI_NATIVE_STUB(ResultType)      _declspec(dllexport) ResultType
  51. #                       define JRI_CALLBACK
  52. #               else /* !_WIN32 */
  53. #                   if defined(_WINDLL)
  54. #                       define JRI_PUBLIC_API(ResultType)       ResultType __cdecl __export __loadds
  55. #                       define JRI_PUBLIC_VAR(VarType)          VarType
  56. #                       define JRI_NATIVE_STUB(ResultType)      ResultType __cdecl __loadds
  57. #                       define JRI_CALLBACK                     __loadds
  58. #               else /* !WINDLL */
  59. #                       define JRI_PUBLIC_API(ResultType)       ResultType __cdecl __export
  60. #                       define JRI_PUBLIC_VAR(VarType)          VarType
  61. #                       define JRI_NATIVE_STUB(ResultType)      ResultType __cdecl __export
  62. #                       define JRI_CALLBACK                     __export
  63. #                   endif /* !WINDLL */
  64. #               endif /* !_WIN32 */
  65. #       elif defined(__BORLANDC__)
  66. #               if defined(WIN32) || defined(_WIN32)
  67. #                       define JRI_PUBLIC_API(ResultType)       __export ResultType
  68. #                       define JRI_PUBLIC_VAR(VarType)          VarType
  69. #                       define JRI_NATIVE_STUB(ResultType)       __export ResultType
  70. #                       define JRI_CALLBACK
  71. #               else /* !_WIN32 */
  72. #                       define JRI_PUBLIC_API(ResultType)       ResultType _cdecl _export _loadds
  73. #                       define JRI_PUBLIC_VAR(VarType)          VarType
  74. #                       define JRI_NATIVE_STUB(ResultType)      ResultType _cdecl _loadds
  75. #                       define JRI_CALLBACK                     _loadds
  76. #               endif
  77. #       elif defined(WATCOM)
  78. #               if defined(WIN32) || defined(_WIN32)
  79. #                       define JRI_PUBLIC_API(ResultType)       __export ResultType
  80. #                       define JRI_PUBLIC_VAR(VarType)          VarType
  81. #                       define JRI_NATIVE_STUB(ResultType)       __export ResultType
  82. #                       define JRI_CALLBACK
  83. #               else /* !_WIN32 */
  84. #                       define JRI_PUBLIC_API(ResultType)       ResultType __cdecl _export _loadds
  85. #                       define JRI_PUBLIC_VAR(VarType)          VarType
  86. #                       define JRI_NATIVE_STUB(ResultType)      ResultType __cdecl _loadds
  87. #                       define JRI_CALLBACK                     _loadds
  88. #               endif
  89. #       else
  90. #               error Unsupported PC development environment.
  91. #       endif
  92. #       ifndef IS_LITTLE_ENDIAN
  93. #               define IS_LITTLE_ENDIAN
  94. #       endif
  95.  
  96. /* Mac */
  97. #elif macintosh || Macintosh || THINK_C
  98. #       if defined(__MWERKS__)                          /* Metrowerks */
  99. #               if !__option(enumsalwaysint)
  100. #                       error You need to define 'Enums Always Int' for your project.
  101. #               endif
  102. #               if defined(GENERATING68K) && !GENERATINGCFM
  103. #                       if !__option(fourbyteints)
  104. #                               error You need to define 'Struct Alignment: 68k' for your project.
  105. #                       endif
  106. #               endif /* !GENERATINGCFM */
  107. #               define JRI_PUBLIC_API(ResultType)       __declspec(export) ResultType
  108. #               define JRI_PUBLIC_VAR(VarType)          JRI_PUBLIC_API(VarType)
  109. #               define JRI_NATIVE_STUB(ResultType)      JRI_PUBLIC_API(ResultType)
  110. #       elif defined(__SC__)                            /* Symantec */
  111. #               error What are the Symantec defines? (warren@netscape.com)
  112. #       elif macintosh && applec                        /* MPW */
  113. #               error Please upgrade to the latest MPW compiler (SC).
  114. #       else
  115. #               error Unsupported Mac development environment.
  116. #       endif
  117. #       define JRI_CALLBACK
  118.  
  119. /* Unix or else */
  120. #else
  121. #       define JRI_PUBLIC_API(ResultType)               ResultType
  122. #   define JRI_PUBLIC_VAR(VarType)          VarType
  123. #       define JRI_NATIVE_STUB(ResultType)                  ResultType
  124. #       define JRI_CALLBACK
  125. #endif
  126.  
  127. #ifndef FAR             /* for non-Win16 */
  128. #define FAR
  129. #endif
  130.  
  131. /******************************************************************************/
  132.  
  133. /* Java Scalar Types */
  134.  
  135. #if 0   /* now in jni.h */
  136. typedef short                   jchar;
  137. typedef short                   jshort;
  138. typedef float                   jfloat;
  139. typedef double                  jdouble;
  140. typedef juint                   jsize;
  141. #endif
  142.  
  143. typedef unsigned char   jbool;
  144. typedef char                    jbyte;
  145. #ifdef IS_64 /* XXX ok for alpha, but not right on all 64-bit architectures */
  146. typedef unsigned int    juint;
  147. typedef int                             jint;
  148. #else
  149. typedef unsigned long   juint;
  150. typedef long                    jint;
  151. #endif
  152.  
  153. /*******************************************************************************
  154.  * jlong : long long (64-bit signed integer type) support.
  155.  ******************************************************************************/
  156.  
  157. /*
  158. ** Bit masking macros.  (n must be <= 31 to be portable)
  159. */
  160. #define JRI_BIT(n)                      ((juint)1 << (n))
  161. #define JRI_BITMASK(n)          (JRI_BIT(n) - 1)
  162.  
  163. #ifdef HAVE_LONG_LONG
  164.  
  165. #if !(defined(WIN32) || defined(_WIN32))
  166. typedef long long                       jlong;
  167. typedef unsigned long long      julong;
  168.  
  169. #define jlong_MAXINT            0x7fffffffffffffffLL
  170. #define jlong_MININT            0x8000000000000000LL
  171. #define jlong_ZERO                      0x0LL
  172.  
  173. #else
  174. typedef LONGLONG                        jlong;
  175. typedef DWORDLONG                       julong;
  176.  
  177. #define jlong_MAXINT            0x7fffffffffffffffi64
  178. #define jlong_MININT            0x8000000000000000i64
  179. #define jlong_ZERO                      0x0i64
  180.  
  181. #endif
  182.  
  183. #define jlong_IS_ZERO(a)        ((a) == 0)
  184. #define jlong_EQ(a, b)          ((a) == (b))
  185. #define jlong_NE(a, b)          ((a) != (b))
  186. #define jlong_GE_ZERO(a)        ((a) >= 0)
  187. #define jlong_CMP(a, op, b)     ((a) op (b))
  188.  
  189. #define jlong_AND(r, a, b)      ((r) = (a) & (b))
  190. #define jlong_OR(r, a, b)       ((r) = (a) | (b))
  191. #define jlong_XOR(r, a, b)      ((r) = (a) ^ (b))
  192. #define jlong_OR2(r, a)         ((r) = (r) | (a))
  193. #define jlong_NOT(r, a)         ((r) = ~(a))
  194.  
  195. #define jlong_NEG(r, a)         ((r) = -(a))
  196. #define jlong_ADD(r, a, b)      ((r) = (a) + (b))
  197. #define jlong_SUB(r, a, b)      ((r) = (a) - (b))
  198.  
  199. #define jlong_MUL(r, a, b)      ((r) = (a) * (b))
  200. #define jlong_DIV(r, a, b)      ((r) = (a) / (b))
  201. #define jlong_MOD(r, a, b)      ((r) = (a) % (b))
  202.  
  203. #define jlong_SHL(r, a, b)      ((r) = (a) << (b))
  204. #define jlong_SHR(r, a, b)      ((r) = (a) >> (b))
  205. #define jlong_USHR(r, a, b)     ((r) = (julong)(a) >> (b))
  206. #define jlong_ISHL(r, a, b)     ((r) = ((jlong)(a)) << (b))
  207.  
  208. #define jlong_L2I(i, l)         ((i) = (int)(l))
  209. #define jlong_L2UI(ui, l)       ((ui) =(unsigned int)(l))
  210. #define jlong_L2F(f, l)         ((f) = (l))
  211. #define jlong_L2D(d, l)         ((d) = (l))
  212.  
  213. #define jlong_I2L(l, i)         ((l) = (i))
  214. #define jlong_UI2L(l, ui)       ((l) = (ui))
  215. #define jlong_F2L(l, f)         ((l) = (f))
  216. #define jlong_D2L(l, d)         ((l) = (d))
  217.  
  218. #define jlong_UDIVMOD(qp, rp, a, b)  \
  219.     (*(qp) = ((julong)(a) / (b)), \
  220.      *(rp) = ((julong)(a) % (b)))
  221.  
  222. #else  /* !HAVE_LONG_LONG */
  223.  
  224. typedef struct {
  225. #ifdef IS_LITTLE_ENDIAN
  226.     juint lo, hi;
  227. #else
  228.     juint hi, lo;
  229. #endif
  230. } jlong;
  231. typedef jlong                           julong;
  232.  
  233. extern jlong jlong_MAXINT, jlong_MININT, jlong_ZERO;
  234.  
  235. #define jlong_IS_ZERO(a)        (((a).hi == 0) && ((a).lo == 0))
  236. #define jlong_EQ(a, b)          (((a).hi == (b).hi) && ((a).lo == (b).lo))
  237. #define jlong_NE(a, b)          (((a).hi != (b).hi) || ((a).lo != (b).lo))
  238. #define jlong_GE_ZERO(a)        (((a).hi >> 31) == 0)
  239.  
  240. /*
  241.  * NB: jlong_CMP and jlong_UCMP work only for strict relationals (<, >).
  242.  */
  243. #define jlong_CMP(a, op, b)     (((int32)(a).hi op (int32)(b).hi) ||          \
  244.                                  (((a).hi == (b).hi) && ((a).lo op (b).lo)))
  245. #define jlong_UCMP(a, op, b)    (((a).hi op (b).hi) ||                    \
  246.                                  (((a).hi == (b).hi) && ((a).lo op (b).lo)))
  247.  
  248. #define jlong_AND(r, a, b)      ((r).lo = (a).lo & (b).lo,                    \
  249.                                  (r).hi = (a).hi & (b).hi)
  250. #define jlong_OR(r, a, b)       ((r).lo = (a).lo | (b).lo,                    \
  251.                                  (r).hi = (a).hi | (b).hi)
  252. #define jlong_XOR(r, a, b)      ((r).lo = (a).lo ^ (b).lo,                    \
  253.                                  (r).hi = (a).hi ^ (b).hi)
  254. #define jlong_OR2(r, a)         ((r).lo = (r).lo | (a).lo,                    \
  255.                                  (r).hi = (r).hi | (a).hi)
  256. #define jlong_NOT(r, a)         ((r).lo = ~(a).lo,                                \
  257.                                  (r).hi = ~(a).hi)
  258.  
  259. #define jlong_NEG(r, a)         ((r).lo = -(int32)(a).lo,                     \
  260.                                  (r).hi = -(int32)(a).hi - ((r).lo != 0))
  261. #define jlong_ADD(r, a, b) {                                              \
  262.     jlong _a, _b;                                                         \
  263.     _a = a; _b = b;                                                       \
  264.     (r).lo = _a.lo + _b.lo;                                               \
  265.     (r).hi = _a.hi + _b.hi + ((r).lo < _b.lo);                            \
  266. }
  267.  
  268. #define jlong_SUB(r, a, b) {                                              \
  269.     jlong _a, _b;                                                         \
  270.     _a = a; _b = b;                                                       \
  271.     (r).lo = _a.lo - _b.lo;                                               \
  272.     (r).hi = _a.hi - _b.hi - (_a.lo < _b.lo);                             \
  273. }                                                                         \
  274.  
  275. /*
  276.  * Multiply 64-bit operands a and b to get 64-bit result r.
  277.  * First multiply the low 32 bits of a and b to get a 64-bit result in r.
  278.  * Then add the outer and inner products to r.hi.
  279.  */
  280. #define jlong_MUL(r, a, b) {                                              \
  281.     jlong _a, _b;                                                         \
  282.     _a = a; _b = b;                                                       \
  283.     jlong_MUL32(r, _a.lo, _b.lo);                                         \
  284.     (r).hi += _a.hi * _b.lo + _a.lo * _b.hi;                              \
  285. }
  286.  
  287. /* XXX _jlong_lo16(a) = ((a) << 16 >> 16) is better on some archs (not on mips) */
  288. #define _jlong_lo16(a)          ((a) & JRI_BITMASK(16))
  289. #define _jlong_hi16(a)          ((a) >> 16)
  290.  
  291. /*
  292.  * Multiply 32-bit operands a and b to get 64-bit result r.
  293.  * Use polynomial expansion based on primitive field element (1 << 16).
  294.  */
  295. #define jlong_MUL32(r, a, b) {                                            \
  296.      juint _a1, _a0, _b1, _b0, _y0, _y1, _y2, _y3;                        \
  297.      _a1 = _jlong_hi16(a), _a0 = _jlong_lo16(a);                          \
  298.      _b1 = _jlong_hi16(b), _b0 = _jlong_lo16(b);                          \
  299.      _y0 = _a0 * _b0;                                                     \
  300.      _y1 = _a0 * _b1;                                                     \
  301.      _y2 = _a1 * _b0;                                                     \
  302.      _y3 = _a1 * _b1;                                                     \
  303.      _y1 += _jlong_hi16(_y0);                   /* can't carry */         \
  304.      _y1 += _y2;                                /* might carry */         \
  305.      if (_y1 < _y2) _y3 += 1 << 16;             /* propagate */           \
  306.      (r).lo = (_jlong_lo16(_y1) << 16) + _jlong_lo16(_y0);                \
  307.      (r).hi = _y3 + _jlong_hi16(_y1);                                     \
  308. }
  309.  
  310. /*
  311.  * Divide 64-bit unsigned operand a by 64-bit unsigned operand b, setting *qp
  312.  * to the 64-bit unsigned quotient, and *rp to the 64-bit unsigned remainder.
  313.  * Minimize effort if one of qp and rp is null.
  314.  */
  315. #define jlong_UDIVMOD(qp, rp, a, b)     jlong_udivmod(qp, rp, a, b)
  316.  
  317. extern JRI_PUBLIC_API(void)
  318. jlong_udivmod(julong *qp, julong *rp, julong a, julong b);
  319.  
  320. #define jlong_DIV(r, a, b) {                                              \
  321.     jlong _a, _b;                                                         \
  322.     juint _negative = (int32)(a).hi < 0;                                  \
  323.     if (_negative) {                                                      \
  324.         jlong_NEG(_a, a);                                                     \
  325.     } else {                                                              \
  326.         _a = a;                                                               \
  327.     }                                                                     \
  328.     if ((int32)(b).hi < 0) {                                              \
  329.         _negative ^= 1;                                                       \
  330.         jlong_NEG(_b, b);                                                     \
  331.     } else {                                                              \
  332.         _b = b;                                                               \
  333.     }                                                                     \
  334.     jlong_UDIVMOD(&(r), 0, _a, _b);                                       \
  335.     if (_negative)                                                        \
  336.         jlong_NEG(r, r);                                                      \
  337. }
  338.  
  339. #define jlong_MOD(r, a, b) {                                              \
  340.     jlong _a, _b;                                                         \
  341.     juint _negative = (int32)(a).hi < 0;                                  \
  342.     if (_negative) {                                                      \
  343.         jlong_NEG(_a, a);                                                     \
  344.     } else {                                                              \
  345.         _a = a;                                                               \
  346.     }                                                                     \
  347.     if ((int32)(b).hi < 0) {                                              \
  348.         jlong_NEG(_b, b);                                                     \
  349.     } else {                                                              \
  350.         _b = b;                                                               \
  351.     }                                                                     \
  352.     jlong_UDIVMOD(0, &(r), _a, _b);                                       \
  353.     if (_negative)                                                        \
  354.         jlong_NEG(r, r);                                                      \
  355. }
  356.  
  357. /*
  358.  * NB: b is a juint, not jlong or julong, for the shift ops.
  359.  */
  360. #define jlong_SHL(r, a, b) {                                              \
  361.     if (b) {                                                              \
  362.         jlong _a;                                                             \
  363.         _a = a;                                                           \
  364.         if ((b) < 32) {                                                   \
  365.             (r).lo = _a.lo << (b);                                            \
  366.             (r).hi = (_a.hi << (b)) | (_a.lo >> (32 - (b)));                  \
  367.         } else {                                                              \
  368.             (r).lo = 0;                                                       \
  369.             (r).hi = _a.lo << ((b) & 31);                                     \
  370.         }                                                                     \
  371.     } else {                                                              \
  372.         (r) = (a);                                                            \
  373.     }                                                                     \
  374. }
  375.  
  376. /* a is an int32, b is int32, r is jlong */
  377. #define jlong_ISHL(r, a, b) {                                             \
  378.     if (b) {                                                              \
  379.         jlong _a;                                                             \
  380.         _a.lo = (a);                                                          \
  381.         _a.hi = 0;                                                            \
  382.         if ((b) < 32) {                                                   \
  383.             (r).lo = (a) << (b);                                              \
  384.             (r).hi = ((a) >> (32 - (b)));                                     \
  385.         } else {                                                              \
  386.             (r).lo = 0;                                                       \
  387.             (r).hi = (a) << ((b) & 31);                                       \
  388.         }                                                                     \
  389.     } else {                                                              \
  390.         (r).lo = (a);                                                         \
  391.         (r).hi = 0;                                                           \
  392.     }                                                                     \
  393. }
  394.  
  395. #define jlong_SHR(r, a, b) {                                              \
  396.     if (b) {                                                              \
  397.         jlong _a;                                                             \
  398.         _a = a;                                                           \
  399.         if ((b) < 32) {                                                       \
  400.             (r).lo = (_a.hi << (32 - (b))) | (_a.lo >> (b));                  \
  401.             (r).hi = (int32)_a.hi >> (b);                                     \
  402.         } else {                                                              \
  403.             (r).lo = (int32)_a.hi >> ((b) & 31);                              \
  404.             (r).hi = (int32)_a.hi >> 31;                                      \
  405.         }                                                                     \
  406.     } else {                                                              \
  407.         (r) = (a);                                                            \
  408.     }                                                                     \
  409. }
  410.  
  411. #define jlong_USHR(r, a, b) {                                             \
  412.     if (b) {                                                              \
  413.         jlong _a;                                                             \
  414.         _a = a;                                                           \
  415.         if ((b) < 32) {                                                       \
  416.             (r).lo = (_a.hi << (32 - (b))) | (_a.lo >> (b));                  \
  417.             (r).hi = _a.hi >> (b);                                            \
  418.         } else {                                                              \
  419.             (r).lo = _a.hi >> ((b) & 31);                                     \
  420.             (r).hi = 0;                                                       \
  421.         }                                                                     \
  422.     } else {                                                              \
  423.         (r) = (a);                                                            \
  424.     }                                                                     \
  425. }
  426.  
  427. #define jlong_L2I(i, l)         ((i) = (l).lo)
  428. #define jlong_L2UI(ui, l)       ((ui) = (l).lo)
  429. #define jlong_L2F(f, l)         { double _d; jlong_L2D(_d, l); (f) = (float) _d; }
  430.  
  431. #define jlong_L2D(d, l) {                                                 \
  432.     int32 _negative;                                                      \
  433.     jlong _absval;                                                        \
  434.                                                                           \
  435.     _negative = (l).hi >> 31;                                             \
  436.     if (_negative) {                                                      \
  437.         jlong_NEG(_absval, l);                                                \
  438.     } else {                                                              \
  439.         _absval = l;                                                          \
  440.     }                                                                     \
  441.     (d) = (double)_absval.hi * 4.294967296e9 + _absval.lo;                \
  442.     if (_negative)                                                        \
  443.         (d) = -(d);                                                           \
  444. }
  445.  
  446. #define jlong_I2L(l, i)         ((l).hi = (i) >> 31, (l).lo = (i))
  447. #define jlong_UI2L(l, ui)       ((l).hi = 0, (l).lo = (ui))
  448. #define jlong_F2L(l, f)         { double _d = (double) f; jlong_D2L(l, _d); }
  449.  
  450. #define jlong_D2L(l, d) {                                                 \
  451.     int _negative;                                                        \
  452.     double _absval, _d_hi;                                                \
  453.     jlong _lo_d;                                                          \
  454.                                                                           \
  455.     _negative = ((d) < 0);                                                \
  456.     _absval = _negative ? -(d) : (d);                                     \
  457.                                                                           \
  458.     (l).hi = (juint)(_absval / 4.294967296e9);                            \
  459.     (l).lo = 0;                                                           \
  460.     jlong_L2D(_d_hi, l);                                                  \
  461.     _absval -= _d_hi;                                                     \
  462.     _lo_d.hi = 0;                                                         \
  463.     if (_absval < 0) {                                                    \
  464.         _lo_d.lo = (juint) -_absval;                                          \
  465.         jlong_SUB(l, l, _lo_d);                                               \
  466.     } else {                                                              \
  467.         _lo_d.lo = (juint) _absval;                                           \
  468.         jlong_ADD(l, l, _lo_d);                                               \
  469.     }                                                                     \
  470.                                                                           \
  471.     if (_negative)                                                        \
  472.         jlong_NEG(l, l);                                                      \
  473. }
  474.  
  475. #endif /* !HAVE_LONG_LONG */
  476.  
  477. /******************************************************************************/
  478.  
  479. #ifdef HAVE_ALIGNED_LONGLONGS
  480. #define JRI_GET_INT64(_t,_addr) ( ((_t).x[0] = ((jint*)(_addr))[0]), \
  481.                               ((_t).x[1] = ((jint*)(_addr))[1]),      \
  482.                               (_t).l )
  483. #define JRI_SET_INT64(_t, _addr, _v) ( (_t).l = (_v),                \
  484.                                    ((jint*)(_addr))[0] = (_t).x[0], \
  485.                                    ((jint*)(_addr))[1] = (_t).x[1] )
  486. #else
  487. #define JRI_GET_INT64(_t,_addr) (*(jlong*)(_addr))
  488. #define JRI_SET_INT64(_t, _addr, _v) (*(jlong*)(_addr) = (_v))
  489. #endif
  490.  
  491. /* If double's must be aligned on doubleword boundaries then define this */
  492. #ifdef HAVE_ALIGNED_DOUBLES
  493. #define JRI_GET_DOUBLE(_t,_addr) ( ((_t).x[0] = ((jint*)(_addr))[0]), \
  494.                                ((_t).x[1] = ((jint*)(_addr))[1]),      \
  495.                                (_t).d )
  496. #define JRI_SET_DOUBLE(_t, _addr, _v) ( (_t).d = (_v),                \
  497.                                     ((jint*)(_addr))[0] = (_t).x[0], \
  498.                                     ((jint*)(_addr))[1] = (_t).x[1] )
  499. #else
  500. #define JRI_GET_DOUBLE(_t,_addr) (*(jdouble*)(_addr))
  501. #define JRI_SET_DOUBLE(_t, _addr, _v) (*(jdouble*)(_addr) = (_v))
  502. #endif
  503.  
  504. /******************************************************************************/
  505. #ifdef __cplusplus
  506. }
  507. #endif
  508. #endif /* JRI_MD_H */
  509. /******************************************************************************/
  510.