2 * @(#)typedefs.h 1.4 02/09/27
4 * Copyright 1995-1998 by Sun Microsystems, Inc.,
5 * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
8 * This software is the confidential and proprietary information
9 * of Sun Microsystems, Inc. ("Confidential Information"). You
10 * shall not disclose such Confidential Information and shall use
11 * it only in accordance with the terms of the license agreement
12 * you entered into with Sun.
13 * Use is subject to license terms.
19 #include "typedefs_md.h" /* for int64_t */
22 * Macros to deal with the JavaVM's stack alignment. Many machines
23 * require doublewords to be double aligned. This union is used by
24 * code in math.h as a more portable way do alignment on machines
25 * that require it. This union and the macros that use it came from
29 typedef union Java8Str
{
37 #ifdef HAVE_ALIGNED_LONGLONGS
38 #define GET_INT64(_t,_addr) ( ((_t).x[0] = ((int32_t*)(_addr))[0]), \
39 ((_t).x[1] = ((int32_t*)(_addr))[1]), \
41 #define SET_INT64(_t, _addr, _v) ( (_t).l = (_v), \
42 ((int32_t*)(_addr))[0] = (_t).x[0], \
43 ((int32_t*)(_addr))[1] = (_t).x[1] )
45 #define GET_INT64(_t,_addr) (*(int64_t*)(_addr))
46 #define SET_INT64(_t, _addr, _v) (*(int64_t*)(_addr) = (_v))
49 /* If double's must be aligned on doubleword boundaries then define this */
50 #ifdef HAVE_ALIGNED_DOUBLES
51 #define GET_DOUBLE(_t,_addr) ( ((_t).x[0] = ((int32_t*)(_addr))[0]), \
52 ((_t).x[1] = ((int32_t*)(_addr))[1]), \
54 #define SET_DOUBLE(_t, _addr, _v) ( (_t).d = (_v), \
55 ((int32_t*)(_addr))[0] = (_t).x[0], \
56 ((int32_t*)(_addr))[1] = (_t).x[1] )
58 #define GET_DOUBLE(_t,_addr) (*(double*)(_addr))
59 #define SET_DOUBLE(_t, _addr, _v) (*(double*)(_addr) = (_v))
62 /* If pointers are 64bits then define this */
63 #ifdef HAVE_64BIT_POINTERS
64 #define GET_HANDLE(_t,_addr) ( ((_t).x[0] = ((int32_t*)(_addr))[0]), \
65 ((_t).x[1] = ((int32_t*)(_addr))[1]), \
67 #define SET_HANDLE(_t, _addr, _v) ( (_t).p = (_v), \
68 ((int32_t*)(_addr))[0] = (_t).x[0], \
69 ((int32_t*)(_addr))[1] = (_t).x[1] )
71 #define GET_HANDLE(_t,_addr) (*(JHandle*)(_addr))
72 #define SET_HANDLE(_t, _addr, _v) (*(JHandle*)(_addr) = (_v))
83 #endif /* !_TYPEDEFS_H_ */